Commit Graph

2155 Commits

Author SHA1 Message Date
Clark Wang 09ee38d613 use findOrCreate for HasManyThrough#create
see strongloop/loopback-connector-mongodb#92

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-03-21 11:49:28 +08:00
Raymond Feng 5d0b745f31 Merge pull request #520 from fabien/feature/scope-find-by-id
Implement scope.findById
2015-03-20 12:00:56 -07:00
Raymond Feng 2f0561a7a8 Merge pull request #514 from fabien/feature/relation-methods
Enable defineMethod for singular relations
2015-03-20 11:57:45 -07:00
Raymond Feng 4ac227b052 Merge pull request #522 from strongloop/feature/enhance-id-comparison-for-updateAttributes
Enhance id comparision for updateAttributes
2015-03-20 11:06:57 -07:00
Raymond Feng 6a40a8a5e5 Enhance id comparision for updateAttributes
string/number and MongoDB ObjectID equality are now allowed.
2015-03-20 11:06:24 -07:00
Miroslav Bajtoš 84d538c1ca Merge pull request #515 from strongloop/feature/isNewInstance
Add ctx.isNewInstance for "save" hooks
2015-03-20 18:33:55 +01:00
Fabien Franzen b2db020057 Merge branch 'feature/relation-methods' of https://github.com/fabien/loopback-datasource-juggler into feature/relation-methods 2015-03-20 18:16:20 +01:00
Fabien Franzen 54781f376e Enable custom methods on singular relations 2015-03-20 18:15:58 +01:00
Fabien Franzen 34acc6c50a Implement scope.findById 2015-03-20 16:37:46 +01:00
Miroslav Bajtoš 112f2bd652 Merge pull request #518 from strongloop/fix/transient-connector-updateAll-result
Fix updateAll callback in "transient" connector
2015-03-20 08:55:54 +01:00
Miroslav Bajtoš 94e6d893a7 Fix updateAll callback in "transient" connector
Fix the implementation to return an object as the result,
that's the expected API since 04f35b3.
2015-03-20 08:34:58 +01:00
Simon Ho 84448bb0dc Merge pull request #502 from strongloop/feature/memory-connector-returns-updated-record-count
Memory connector returns updated records count
2015-03-19 16:02:00 -07:00
Simon Ho 04f35b31b4 Memory connector returns updated records count
The memory connector now includes the number of updated items in its callback
when updating records.
2015-03-19 15:40:14 -07:00
Raymond Feng a8d8556dcc Merge pull request #499 from clarkorz/fix/merge-mixins
fix #429 Multiple Models can't mixin same class
2015-03-19 13:21:22 -07:00
Miroslav Bajtoš e83edf8555 Merge pull request #511 from strongloop/feature/report-count-of-deleted-instances
deleteAll returns number of deleted records
2015-03-19 19:01:30 +01:00
Miroslav Bajtoš ffcaa4e76e Add ctx.isNewInstance for "save" hooks
"before save" hooks provide "ctx.isNewInstance" whenever "ctx.instance"
is set. Possible values:
 - true for all CREATE operations
 - false for all UPDATE operations
 - undefined for "prototype.save"

"after save" hooks provide "ctx.isNewInstance" whenever "ctx.instance"
is set. Possible values:
 - true after all CREATE operations
 - false after all UPDATE operations
 - undefined after "updateOrCreate" and "save"

Note: both "updateOrCreate" and "prototype.updateAttributes"
don't provide `ctx.instance` to "before save" hooks, therefore
`ctx.isNewInstance` it not provided either.
2015-03-19 18:05:24 +01:00
Miroslav Bajtoš d731252941 deleteAll returns number of deleted records
The number is returned as `data.ctx` to `cb(null, data)`.
2015-03-19 17:54:22 +01:00
Miroslav Bajtoš ae3dc3cec2 Merge pull request #510 from strongloop/fix/duplicate-create
Reject CREATE with a duplicate id
2015-03-19 17:37:01 +01:00
Fabien Franzen 8f88a42395 Enable custom methods on singular relations 2015-03-19 17:13:18 +01:00
Raymond Feng 579895d1b3 Merge pull request #513 from strongloop/feature/fix-issue-512
Use the correct way to iterate over an array
2015-03-18 08:22:06 -07:00
Raymond Feng cd1d815936 Use the correct way to iterate over an array
See https://github.com/strongloop/loopback-datasource-juggler/issues/512
2015-03-18 08:21:32 -07:00
Raymond Feng 01fb5db550 Merge pull request #509 from dbarbeau/master
Enable "between" filter for memory db connector
2015-03-16 10:41:38 -07:00
Miroslav Bajtoš 6f11c2d717 DAO: Fix updateOrCreate to set persisted:true
Before this commit, the following code would not work:

    Change.updateOrCreate({...}, function(err, ch) {
      // somewhere later, modify "ch" and save the changes
      ch.save(cb);
    });
2015-03-16 18:26:42 +01:00
Miroslav Bajtoš 902772f1af Reject CREATE with a duplicate id
Modify the memory connector to reject requests to create a record
with a duplicate id.

Add a unit-test to verify this behaviour across all connectors.
2015-03-16 18:26:42 +01:00
Daniel B. Vasquez 3de94cb9bd add tests for between in memory connector 2015-03-16 18:26:33 +01:00
Raymond Feng 53d694b429 2.21.0
* Fix the test case so that at least one property is to be changed (Raymond Feng)

 * Make sure id properties cannot be changed (Raymond Feng)
2015-03-16 09:54:06 -07:00
Raymond Feng eb9a8f59e5 Merge pull request #508 from strongloop/feature/fix-update-attrs
Make sure id properties cannot be changed
2015-03-16 09:53:10 -07:00
Raymond Feng f91399a307 Fix the test case so that at least one property is to be changed 2015-03-16 09:26:03 -07:00
Raymond Feng 04348a1168 Make sure id properties cannot be changed 2015-03-16 09:25:38 -07:00
Daniel B. Vasquez 9aeaa37b1c enable between filter for memory db connector 2015-03-16 11:21:04 +01:00
Raymond Feng 7dc0fcd26f 2.20.0
* Remove trailing spaces. (Miroslav Bajtoš)

 * Improve instance-level operation hooks (Fabien Franzen)

 * Fix the test case (Raymond Feng)

 * fix foreign key dataType bug (didikeke)

 * Reformat notifyObserversOf context argument (Fabien Franzen)

 * Implement operation hooks' context (Fabien Franzen)

 * Allow submodel to hide base properties (Raymond Feng)
2015-03-12 10:22:05 -07:00
0angelic0 befe30f14a Add abilities to remove and clear observers - Operation Hooks. 2015-03-11 18:08:35 +07:00
Miroslav Bajtoš 274a5c778a Remove trailing spaces. 2015-03-11 09:39:16 +01:00
Miroslav Bajtoš bc541046f1 Merge pull request #488 from fabien/feature/op-hooks
Improve instance-level operation hooks

Close #488
2015-03-11 09:36:19 +01:00
Fabien Franzen 8605da3ac6 Improve instance-level operation hooks
"before delete" and "after delete" hooks receive `ctx.instance`
when a single model is being deleted.

"before save" hook receives `ctx.currentInstance` when triggered
by `prototype.updateAttributes()`.

Note that "after save" hook triggered by `prototype.updateAttributes()`
already provides `ctx.instance`.
2015-03-11 09:35:46 +01:00
Clark Wang 90e169c1a6 fix #429 Multiple Models can't mixin same class
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-03-11 16:08:50 +08:00
Raymond Feng 2a24273b4f Fix the test case 2015-03-10 21:26:36 -07:00
Raymond Feng 9083370e17 Merge pull request #498 from didikeke/master
fix foreign key dataType bug
2015-03-10 21:22:51 -07:00
didikeke 3644b85432 fix foreign key dataType bug 2015-03-11 11:30:40 +08:00
Raymond Feng 159be756ac Merge pull request #494 from strongloop/feature/allow-submodel-to-hide-base-properties
Allow submodel to hide base properties
2015-03-09 13:16:09 -07:00
Raymond Feng 6b04568707 Merge pull request #485 from fabien/feature/op-hooks-state
Implement #484 : hookState
2015-03-05 08:38:38 -08:00
Fabien Franzen 18b58558cc Reformat notifyObserversOf context argument 2015-03-05 15:53:34 +01:00
Fabien Franzen f42859f2e5 Implement operation hooks' context 2015-03-05 11:55:04 +01:00
Raymond Feng b7abb08da8 2.19.2
* Improved and corrected API docs (crandmck)

 * Fix problems in annotations that prvented validateAsync and validate functions from appearing in API docs. (crandmck)
2015-03-04 22:19:51 -08:00
crandmck d4b0a26a0e Improved and corrected API docs 2015-03-04 17:21:25 -08:00
crandmck 27f2e69981 Merge branch 'master' of https://github.com/strongloop/loopback-datasource-juggler 2015-03-03 16:59:14 -08:00
crandmck e81415ceda Fix problems in annotations that prvented validateAsync and validate functions from appearing in API docs. 2015-03-03 16:58:19 -08:00
Raymond Feng 666e15f8a4 2.19.1
* Make sure inclusion filter is applied to the target model (Raymond Feng)
2015-03-03 11:11:19 -08:00
Raymond Feng 33d3239b44 Allow submodel to hide base properties 2015-03-03 10:27:22 -08:00
Raymond Feng 4bbbf7906e Merge pull request #476 from strongloop/feature/fix-lb-1076
Make sure inclusion filter is applied to the target model
2015-03-02 11:04:12 -08:00