Commit Graph

1930 Commits

Author SHA1 Message Date
Miroslav Bajtoš 081544edb5 Merge pull request #458 from strongloop/feature/property-defaultfn
Add a new property option `defaultFn`
2015-02-20 20:14:44 +01:00
Miroslav Bajtoš ba0f3c1616 Add a new property option `defaultFn`
The property allows developers to specify that the default value
should be retrieved via a named function.

Only two built-in functions are supported at the moment:

  "guid", "uuid" - generate a new GUID/UUID
  "now" - use the current date and time

Support for custom (user-provided) functions is not implemented yet.
2015-02-20 20:08:25 +01:00
Raymond Feng a713f25d61 Fix the null/undefined check 2015-02-20 09:55:09 -08:00
Raymond Feng 02503e7635 Fix createdAt type so that it won't overflow SQL server int 2015-02-20 09:33:54 -08:00
Miroslav Bajtoš c939efe1e7 Merge pull request #445 from PradnyaBaviskar/issue292
Add $now as shortcut default value for date property
2015-02-17 19:46:05 +01:00
Miroslav Bajtoš 9e0a22141a Merge pull request #449 from strongloop/feature/promises-for-operation-hooks
Promises for operation hooks
2015-02-17 18:22:58 +01:00
Miroslav Bajtoš 76ebdcb91b ModelBaseClass: promise mode for notifyObserversOf
Support both promise and callback styles in
ModelBaseClass.notifyObserversOf.

When there is no callback supplied, the method returns a promise that
is resolved (or rejected) with the result.
2015-02-17 18:19:21 +01:00
Miroslav Bajtoš a2836fbb56 ModelBaseClass: support promise-based observers
Allow the observer functions passed to `ModelBaseClass.observe`
to return a promise instead of calling the callback.
2015-02-17 17:31:42 +01:00
Raymond Feng a44e45b30a Merge pull request #394 from clarkbw/hasManyThroughKeyThrough
hasMany through doesn't set the through key value
2015-02-16 22:45:06 -08:00
Bryan Clark 98fcf6b52c use lodash to update the findBelongsTo which now returns an array of matches 2015-02-16 15:36:51 -08:00
Pradnya Baviskar aba7d0dc10 Add $now as shortcut default value for date property 2015-02-16 11:32:24 +05:30
Miroslav Bajtoš 03717d3798 Merge pull request #446 from strongloop/fix/ci-build
Fix `deleteById(id)` and other test failures
2015-02-13 19:20:22 +01:00
Miroslav Bajtoš 46ff76dda0 Fix `deleteById(id)` and other test failures 2015-02-13 09:34:40 -08:00
Raymond Feng b4189bf997 2.17.0
* Add an optional `options` argument to all CRUD methods (Raymond Feng)

 * Upgrade deps (Raymond Feng)

 * Remove workaround for perfomance degradation (Denis Bardadym)

 * Change equal to eql to support mongodb ObjectID (Raymond Feng)

 * Enhance the coercion for boolean/date types (Raymond Feng)

 * Make sure base properties/settings are merged into the submodel (Raymond Feng)

 * support optimized findOrCreate (Clark Wang)

 * Fix the perf around should.not.equal for complex objects (Raymond Feng)

 * testcase for #420 (Andrey Loukhnov)

 * use findOrCreate in hasOne#create (Clark Wang)

 * Create model foreign key matching type of opposite part of relation (even if it has a custom field type) (Andrey Loukhnov)

 * minor formatting issues (trailing spaces and such) and .editorconfig (Andrey Loukhnov)
2015-02-11 20:59:24 -08:00
Raymond Feng cc1791b01d Merge pull request #423 from clarkorz/hasOne-findOrCreate
use findOrCreate in hasOne#create
2015-02-11 20:51:33 -08:00
Raymond Feng 96c39509c9 Merge branch 'clarkorz-featrue/support-connector-findOrCreate' 2015-02-11 20:50:49 -08:00
Raymond Feng bcbb9c580d Merge branch 'featrue/support-connector-findOrCreate' of https://github.com/clarkorz/loopback-datasource-juggler into clarkorz-featrue/support-connector-findOrCreate 2015-02-11 20:49:51 -08:00
Raymond Feng a8f3d21b65 Merge pull request #436 from strongloop/feature/fix-issue-293
Make sure base properties/settings are merged into the submodel
2015-02-11 16:13:00 -08:00
Raymond Feng 9bac813f59 Merge pull request #435 from strongloop/feature/add-options-to-crud-methods
Add an optional `options` argument to all CRUD methods
2015-02-11 10:31:18 -08:00
Raymond Feng 760ac97902 Add an optional `options` argument to all CRUD methods 2015-02-10 23:57:05 -08:00
Raymond Feng 770c69b1d4 Upgrade deps 2015-02-10 09:49:54 -08:00
Raymond Feng 4c2d508151 Merge pull request #439 from btd/master
Remove workaround for perfomance degradation in should.js
2015-02-10 09:47:42 -08:00
Denis Bardadym 32e534732c Remove workaround for perfomance degradation 2015-02-10 13:28:47 +03:00
Raymond Feng 9cfc47bc8f Merge pull request #437 from strongloop/feature/enhance-boolean-coercion
Enhance the coercion for boolean/date types
2015-02-09 14:57:27 -08:00
Raymond Feng 919d32c4dc Change equal to eql to support mongodb ObjectID 2015-02-08 11:14:51 -08:00
Raymond Feng ecf84bf802 Enhance the coercion for boolean/date types
See https://github.com/strongloop/loopback-connector-mongodb/issues/90
2015-02-08 10:54:42 -08:00
Raymond Feng cd2bd34619 Make sure base properties/settings are merged into the submodel
See https://github.com/strongloop/loopback-datasource-juggler/issues/293
2015-02-07 11:15:28 -08:00
Clark Wang 0bef56efc0 support optimized findOrCreate
Signed-off-by: Clark Wang <clark.wangs@gmail.com>

remove undefined for creating data in findOrCreate

Signed-off-by: Clark Wang <clark.wangs@gmail.com>

getLastGeneratedUid instead of force an id

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-02-07 10:23:04 +08:00
Raymond Feng e9c966227d Merge pull request #420 from aol-nnov/fkCustomDbType
Create model foreign key matching type of opposite part of relation (even if it has a custom field type)
2015-02-05 10:28:04 -08:00
Raymond Feng 90063bc222 Merge pull request #431 from strongloop/feature/fix-should-not-equal-perf
Fix the perf around should.not.equal for complex objects
2015-02-05 09:32:02 -08:00
Raymond Feng c9e78f6bd2 Fix the perf around should.not.equal for complex objects 2015-02-05 08:22:17 -08:00
Miroslav Bajtoš 8d338eade9 Merge tag 'v2.16.0'
2.16.0

 * Return 400 when client provides an incorrect value (Pradnya Baviskar)

 * Relax "id" checks in test/manipulation.test.js (Miroslav Bajtoš)

 * Fix typo (Raymond Feng)

 * test: undefined property values are preserved (Miroslav Bajtoš)

 * Remove undefined properties for create (Raymond Feng)

 * Update to `should` to the latest version 4.6.3 (Miroslav Bajtoš)

 * Relax the id equality test for mongodb object ids (Raymond Feng)
2015-02-05 12:47:37 +01:00
Miroslav Bajtoš 169e270925 Merge branch 'release/2.16.0' into production 2015-02-05 12:47:35 +01:00
Miroslav Bajtoš aca258f7e0 v2.16.0 2015-02-05 12:47:33 +01:00
Miroslav Bajtoš 2e2e01cc5c Merge pull request #430 from PradnyaBaviskar/issue709
Return 400 when client provides an incorrect value
2015-02-05 12:42:54 +01:00
Pradnya Baviskar be37fb4388 Return 400 when client provides an incorrect value 2015-02-05 16:58:42 +05:30
Andrey Loukhnov 3ce6a2618f testcase for #420 2015-02-05 10:12:34 +03:00
Miroslav Bajtoš c013ae4d38 Merge pull request #428 from strongloop/fix/manipulation-tests-in-mongodb
Relax "id" checks in test/manipulation.test.js
2015-02-04 19:27:12 +01:00
Miroslav Bajtoš 04083678c0 Relax "id" checks in test/manipulation.test.js
Use `eql` instead of `equal` to support non-scalar id values
used by MongoDB connector.
2015-02-04 19:20:56 +01:00
Miroslav Bajtoš 4889443ed0 Merge pull request #422 from strongloop/feature/fix-mongodb-issue-87
Remove undefined properties for create
2015-02-04 19:11:02 +01:00
Raymond Feng 78aca02651 Merge pull request #426 from strongloop/feature/fix-typo
Fix typo
2015-02-04 08:30:36 -08:00
Raymond Feng 79eabf3cf9 Fix typo 2015-02-04 08:30:13 -08:00
Miroslav Bajtoš 7a7fcb2e34 test: undefined property values are preserved 2015-02-04 09:08:28 +01:00
Clark Wang 09f7c92cbe use findOrCreate in hasOne#create
So hasOne#create could take advantage from optimized findOrCreate,
which can avoid multiple creation among concurrent requests.

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-02-04 14:54:28 +08:00
Miroslav Bajtoš 9b675ef3dc Merge pull request #421 from strongloop/feature/update-should
Update to `should` to the latest version 4.6.3
2015-02-03 19:38:39 +01:00
Raymond Feng 9769df2c91 Remove undefined properties for create
See https://github.com/strongloop/loopback-connector-mongodb/issues/87
2015-02-03 08:35:18 -08:00
Miroslav Bajtoš 3593127ef3 Update to `should` to the latest version 4.6.3 2015-02-03 11:44:15 +01:00
Andrey Loukhnov e68ecb461a Create model foreign key matching type of opposite part of relation (even if it has a custom field type) 2015-02-03 13:13:00 +03:00
Andrey Loukhnov ac547433b1 minor formatting issues (trailing spaces and such) and .editorconfig 2015-02-03 13:08:23 +03:00
Raymond Feng 1f0f4b0f02 Relax the id equality test for mongodb object ids 2015-02-02 10:51:41 -08:00