Commit Graph

2458 Commits

Author SHA1 Message Date
Dimitris Halatsis ea2266e453 Persist changes on parent for embedsOne
Allow direct save of changes on embedded model to be persisted on
parent document.

    Person.embedsOne(Address);
    Person.findById(someId)
      .then(function(p){
        var address = p.addressItem();
        address.street = 'new street'
        // This will now persist changes on parent document
        return address.save();
      })

[forward-port of #949]
2016-06-07 17:24:59 +02:00
Amir-61 b039b51610 Merge pull request #964 from strongloop/fixup-master
Fix
2016-06-04 21:23:16 -04:00
Amir Jafarian 8f2077e344 Fix 2016-06-03 18:00:21 -04:00
Ritchie Martori 293a22fd31 Update datasource.js
Return a real `Error` message for the default `ping()` method.
2016-06-02 14:02:06 -07:00
Amir-61 6028826826 Merge pull request #953 from strongloop/fix_error_message
Fix error message
2016-06-02 08:24:59 -04:00
Amir Jafarian cae44f0458 Fix error message
*Fix error message when PK is changed in `replaceById`
2016-06-01 16:16:35 -04:00
Amir-61 8f347fbacb Merge pull request #954 from strongloop/callback_err_from_connector_UPSERT
Retun err for UPSERT if the connector returns err
2016-06-01 15:51:35 -04:00
Miroslav Bajtoš 0e4af6d453 Merge pull request #955 from strongloop/feature/strictEmbeddedModels
ModelBuilder: add new setting strictEmbeddedModels
2016-06-01 13:39:51 +02:00
Dimitris Halatsis b7ba73f1b1 ModelBuilder: add new setting strictEmbeddedModels
The setting controls the strict mode used for embedded property types,
for example the type of "address" property in this model definition:

    modelBuilder.define('TestEmbedded', {
      name: 'string',
      address: {
        street: 'string',
      },
    });
2016-06-01 13:12:50 +02:00
Miroslav Bajtoš 6ec66a7e4a Merge pull request #950 from strongloop/add_test_description
Add test's description
2016-06-01 09:57:53 +02:00
Amir Jafarian 82546fdf47 Retun err for UPSERT if the connector returns err 2016-05-31 22:17:23 -04:00
Alex Pitigoi 5b025075dc Merge pull request #944 from strongloop/fix-mixin-err-handler
[SEMVER-MAJOR] throw error for undefined mixin
2016-05-31 13:10:08 -04:00
Alex Pitigoi 423db34bf3 fix error handling when applying undefined mixins 2016-05-31 12:24:04 -04:00
Amir Jafarian 2b6ced06a1 Add test's description 2016-05-31 11:13:28 -04:00
Amir-61 1f94f63bc1 Merge pull request #938 from strongloop/replace_incompatibility_fix
Fix incompatibility between different connectors for replace methods
2016-05-28 09:06:34 -04:00
Amir Jafarian d9a3f6226a Fix incompatibility between different connectors
* Fix incompatibility for replace methods between different connectors.
2016-05-27 13:45:24 -04:00
Miroslav Bajtoš 795952c182 Merge pull request #943 from strongloop/fix/travis
travis: add v4, v6, drop io.js
2016-05-23 11:24:06 +02:00
Miroslav Bajtoš 376ac4649e travis: add v4, v6, drop io.js 2016-05-23 11:13:40 +02:00
Miroslav Bajtoš 119a1bc6c4 Merge pull request #937 from strongloop/juggler-rel-test
fix avoid duplicate record on scope with promise
2016-05-20 14:56:55 +02:00
Alex Pitigoi 0e89a9c837 fix avoid duplicate record on scope with promise 2016-05-19 15:47:31 -04:00
Simon Ho 3113333cb2 Merge pull request #922 from Sequoia/patch-2
Document promise support for DAO::find
2016-05-11 16:10:48 -07:00
Sequoia McDowell ae7a5df47b Document promise support for DAO::find
It was previously completely undocumented. There are additional methods that add promises but I figure accurately documenting some is better than none. :)
2016-05-11 09:58:22 -04:00
Simon Ho 71e7e5b618 Merge pull request #926 from strongloop/refactor/set-eslint-as-devdep
Set ESLint as devdep
2016-05-10 13:35:33 -07:00
Simon Ho dae0bf863e Set ESLint as devdep 2016-05-10 12:38:30 -07:00
Simon Ho 1d39e41d00 Merge pull request #924 from strongloop/refactor/remove-makefile
Use mocha instead of Makefile for testing
2016-05-10 11:59:33 -07:00
Simon Ho 5be2b3f867 Use mocha instead of Makefile for testing 2016-05-10 11:56:35 -07:00
Miroslav Bajtoš 2189b9a746 Merge pull request #918 from strongloop/fix/remove-chaining-in-create
[SEMVER-MAJOR] DAO.create: don't return the instance
2016-05-02 13:09:03 +02:00
Miroslav Bajtoš 8ad53a4c0e DAO.create: don't return the instance
Simplify DataAccessObject.create() and stop returning the
instance/array of instances. Users should always use callback (or
returned promise) to get the instance(s) created.
2016-04-29 14:16:06 +02:00
Miroslav Bajtoš 89bf94245b Merge pull request #917 from strongloop/doc/add-item-to-release-notes
RELEASE-NOTES: describe 30283291
2016-04-28 19:10:30 +02:00
Miroslav Bajtoš 41d71c5a5b RELEASE-NOTES: describe 30283291
Add an entry for a breaking change made in 30283291 that was not
described previously.
2016-04-28 13:23:50 +02:00
Miroslav Bajtoš ca0c3aaa47 Merge pull request #911 from strongloop/feature/hooks-for-embeds-many
Implement operation hooks for EmbedsMany methods
2016-04-27 17:05:59 +02:00
Miroslav Bajtoš 9bde8f859b Implement operation hooks for EmbedsMany methods
create() triggers
 - before save
 - after save

updateById() triggers
 - before save
 - after save

destroy() triggers
 - before delete
 - after delete

The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.

Limitations:

 - `before save` & `after save` hooks don't provide `ctx.isNewInstance`
 - async validations are not supported yet
 - `persist` and `loaded` hooks are not triggered at all

 - `before delete` hook does not provide `ctx.where` property and
    it's not possible to change the outcome of `destroy()` using this
    hook. Note that regular DAO does support this.

 - updating embedded instances triggers update of the parent (owning)
   model, which is correct and expected. However, the context provided
   by `before save` and `after save` hooks on the parent model is sort of
   arbitrary and may include wrong/extra data. The same probably applies
   to the scenario when deleting embedded instances triggers update of
   the parent model.
2016-04-27 11:04:15 +02:00
Miroslav Bajtoš 7247b6637e Merge pull request #904 from strongloop/feature/hooks-for-embeds-one
Implement operation hooks for EmbedsOne methods
2016-04-20 10:29:51 +02:00
Miroslav Bajtoš b86615e2b7 Implement operation hooks for EmbedsOne methods
create() triggers
 - before save
 - after save

udpate() triggers
 - before save
 - after save

destroy() triggers
 - before delete
 - after delete

The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.
2016-04-20 09:36:12 +02:00
Miroslav Bajtoš 2ffc15a70c Merge pull request #909 from strongloop/eslint/config-loopback-v2.0
eslint config 2.0 + remove extra empty lines
2016-04-19 17:05:12 +02:00
Miroslav Bajtoš c7f34c3452 eslint config 2.0 + remove extra empty lines
Upgrade eslint-config-loopback to ^2.0.0.

Remove extra empty lines to make `npm run lint` pass again.
2016-04-19 16:11:43 +02:00
Amir-61 cd8be0e0a6 Merge pull request #893 from strongloop/hashed_password_tests
Test coverages for hashed password
2016-04-15 12:53:26 -04:00
Amir Jafarian 11ef948854 Test coverages for hashed password
* Test coverages for hashed password for replaceAttributes
* Test coverages for hashed password for updateAttribute
2016-04-14 18:27:19 -04:00
Amir-61 cd5f8b0ee7 Merge pull request #896 from strongloop/forceId_check_replaceById_fix
Fix `forceId` check for `replaceById`
2016-04-14 16:57:02 -04:00
Amir Jafarian 4e6351b856 Fix `forceId` check for `replaceById` 2016-04-14 15:05:56 -04:00
Amir-61 281f554365 Merge pull request #898 from strongloop/fix_notify_find_bugs
Fix notify for find method
2016-04-13 16:17:23 -04:00
Amir Jafarian e9afb46eda Fix `notify` bugs for `find` 2016-04-13 13:34:51 -04:00
Miroslav Bajtoš c9388fa955 Merge pull request #902 from strongloop/refactor/context-test-helpers
test: extract helpers used in tests for operation hooks
2016-04-13 15:04:10 +02:00
Miroslav Bajtoš 09f4c7d026 test: extract hook-monitor helper 2016-04-13 13:54:17 +02:00
Miroslav Bajtoš 616a81b496 test: extract uid-generator helper 2016-04-13 13:53:31 +02:00
Miroslav Bajtoš 3435b43a5c test: extract context-test-helpers 2016-04-13 13:52:54 +02:00
Amir-61 063983ccc9 Merge pull request #888 from strongloop/define_patch_aliases
Define `patch` aliases
2016-04-12 16:17:35 -04:00
Amir Jafarian 4bb284bb60 Define `patch` aliases
*Define `patchOrCreate` as an alias for `updateOrCreate`
*Define `PatchAttributes` as an alias for `updateAttributes`
2016-04-12 13:40:01 -04:00
Miroslav Bajtoš 1e8fe6a0d7 3.0.0-alpha.4
* Partition by foreign key for pagination (Raymond Feng)
 * Fix style errors (Raymond Feng)
 * fix remaining eslint issues (Miroslav Bajtoš)
 * eslint --fix (Miroslav Bajtoš)
 * Add eslint as "npm run lint" and "posttest" hook (Miroslav Bajtoš)
 * Remove unused support/ files (Miroslav Bajtoš)
 * Insert copyright headers (Ryan Graham)
 * Relicense as MIT only (Ryan Graham)
 * Fix Mongo compatibility issue (Amir Jafarian)
 * Add automigrate to setup tables for replace test cases (Amir Jafarian)
 * Allow test folder to be published (Amir Jafarian)
 * support custom field settings under the connector's namespace (bitmage)
 * Update error message for missing connector (gunjpan)
 * Fix tests for mysql (Amir Jafarian)
 * Add forgotten unit test (Miroslav Bajtoš)
 * fix nin support for in memory datasource (Horia Radu)
 * Improve error message on connector init error (Miroslav Bajtoš)
 * discoverSchemas returns an error when modelName is not found, discoverSchema forwards that error and does not hang when no columns, no errors are returned (bitmage)
2016-04-07 09:21:38 +02:00
Simon Ho 85ed753609 Merge pull request #786 from strongloop/feature/fix-610
Partition by foreign key for pagination
2016-04-06 14:01:08 -07:00