sklyukin
483cd873e7
primaryKey to hasOne relation
2015-09-01 01:31:28 +05:00
Raymond Feng
682f6340d3
Optimze automigrate() to cut the test time signicantly
2015-08-27 15:59:58 -07:00
ningsuhen
052e22ab43
Fix for issues #622 & #623
...
polymorphic hasOne needs separate handling and hasMany->referencesMany has a unique case which is fixed for MongoDB as suggested by @fabien.
2015-06-12 01:55:25 +05:30
mamboer
69bd7c1233
Merge remote-tracking branch 'upstream/master'
2015-05-26 12:28:11 +08:00
Raymond Feng
eac74ad014
Make sure relation scope is applied during include
2015-05-16 11:49:02 -07:00
mamboer
5ff3798e8e
enhancement on #588
2015-05-14 09:55:54 +08:00
mamboer
d27b2eb25f
fix issue #587
2015-05-13 13:18:50 +08:00
Raymond Feng
33bbd8634c
Fix the test cases
2015-04-24 16:50:15 -07:00
ningsuhen
7861c08e5a
add test case for hasmanythrough bi-drectional relations
2015-04-25 01:32:33 +05:30
Partap Davis
29eb3434c7
Promisify model relation methods
...
When a callback is omitted from a method on a model relation that
supports promises, return that promise. This includes all the standard
DAO methods, as well as any user-defined methods that return promises.
e.g.:
mylist.todos.create({name: 'Item 1'}) // returns Promise
This API will use native ES6 promises if available. If not available,
or to force the use of another Promise library, you must assign the
global.Promise object.
e.g.:
global.Promise = require('bluebird')
Relations affected:
- BelongsTo
- HasOne
- HasMany
- HasManyThrough
- HasAndBelongsToMany
- ReferencesMany
- EmbedsOne
Exceptions:
The EmbedsMany relation has not been promisified, because most of the
methods return synchronous values.
The base relation getter method [e.g.: mylist.todos()] has not been
promisified, due to its default caching behavior.
New Methods:
- getAsync(condition, cb)
A new method "getAsync()" has been added to all relations except
EmbedsMany, which always fetches from the datasource rather than from
the cache. It takes an optional "where" condition (except for HasOne
and BelongsTo) and an optional callback. If the callback is omitted,
a Promise is returned.
2015-04-07 11:41:07 +02:00
Fabien Franzen
17c8576097
Save parent model of embedded relations
2015-04-01 16:59:21 +02:00
Fabien Franzen
aa5943f6b0
Properly support embedsMany destroyAll
2015-03-24 15:39:55 +01:00
Fabien Franzen
54781f376e
Enable custom methods on singular relations
2015-03-20 18:15:58 +01:00
Raymond Feng
8042eeb3b1
Make sure inclusion filter is applied to the target model
...
See https://github.com/strongloop/loopback/issues/1076
2015-02-28 10:53:18 -08:00
Raymond Feng
a42e3b3d30
Add err checks
2015-02-20 21:14:48 -08:00
Raymond Feng
195752eaad
Fix the idType so that it works with both MongoDB and RDBs
2015-02-20 16:39:48 -08:00
Raymond Feng
841f2d8f14
Tidy up tests so that they will work with RDBs
2015-02-20 16:10:25 -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
Miroslav Bajtoš
3593127ef3
Update to `should` to the latest version 4.6.3
2015-02-03 11:44:15 +01:00
Raymond Feng
1f0f4b0f02
Relax the id equality test for mongodb object ids
2015-02-02 10:51:41 -08:00
Raymond Feng
e46bd0cdb5
Fix hasOne remoting
2015-01-29 23:26:11 -08:00
Fabien Franzen
a08ef823be
Supply target to applyProperties function
2015-01-26 19:09:29 +01:00
Clark Wang
83c3a17f87
support embeds data for belongsTo relation
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-01-19 22:56:09 +08:00
Raymond Feng
4aeb831bd5
Merge pull request #358 from clarkorz/fix/beforeCreate-belongsTo
...
fix recursive calls if create belongsTo model in beforeCreate hook
2015-01-14 14:42:29 -08:00
Miroslav Bajtoš
9b759c95ac
Include property value in the error message
...
When building a list of errors for `ValidationError.message`, include
the values of invalid properties too.
In order to keep the message reasonably short, the values are truncated
at approx 32 characters.
2015-01-12 17:12:18 +01:00
Raymond Feng
73d022398a
Relax the id comparison
2014-12-08 16:18:42 -08:00
Clark Wang
9d2e6516c3
fix embedsOne error when embed instance is undefined or null
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-11-28 13:45:47 +08:00
Clark Wang
40f03f084b
fix recursive calls if create belongsTo model in beforeCreate hook
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-11-24 19:20:38 +08:00
Clark Wang
a9cc1c38df
Allow hasOne relation to have a scope option
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-11-20 19:27:04 +08:00
Raymond Feng
ba29669e0d
Merge branch 'fix/350-create-batch-hasmany-relation' of github.com:BuddyHOPP/loopback-datasource-juggler into BuddyHOPP-fix/350-create-batch-hasmany-relation
2014-11-13 12:50:21 -08:00
bitmage
d11eacffc6
handle relationship create with [array]
2014-11-11 14:48:34 -07:00
Alex Voitau
5c2468c4ef
#350 : Creating a batch via hasMany relation is failing. Added handling of array argument.
2014-11-07 18:01:18 -08:00
Alex Voitau
f1638e9e4c
#350 : Creating a batch via hasMany relation is failing. Added context 'with scope' to allow individual execution of tests.
2014-11-07 15:21:15 -08:00
Pandaiolo
833c24a2a3
Tests for non standard id - hasOne and polymorphic
2014-10-29 12:06:05 +01:00
Fabien Franzen
2838158139
Fix failing test
2014-10-09 18:18:04 +02:00
Fabien Franzen
ad55681d69
Properly reset Memory connector cache on automigrate
2014-10-09 18:13:58 +02:00
Raymond Feng
b5cebd75a7
Merge pull request #303 from khashayar/feature/test-improvement
...
Test improvement, shows _targetClass camelCase bug
2014-09-23 16:37:59 -07:00
Khashayar Hajian
28a661a81a
Test improvement, shows _targetClass camelCase bug
...
There is an issue where setting _targetClass on hasAndBelongsToMany
relations with a camel-case model name, fails.
Signed-off-by: Khashayar Hajian <me@khashayar.me>
2014-09-17 17:28:40 +02:00
Raymond Feng
3655107334
Merge pull request #295 from fabien/fix/embeds-many
...
Various improvements to embedded relations
2014-09-12 10:31:49 -07:00
Fabien Franzen
d1a08ef6b3
Add test case for Numeric ids (with optional forceId)
2014-09-07 20:54:11 +02:00
Fabien Franzen
e441924fa3
Allow embedsOne to use auto-generated id (from connector)
...
If the connector has a `generateId` method - like Transient - it can be
used to set the id (when the property has been set to `generated:
true`).
2014-09-07 13:24:05 +02:00
Fabien Franzen
21e1083e88
Implemented persistent: true option for embedsOne
2014-09-07 13:10:23 +02:00
Fabien Franzen
95764232b9
Introduce embedsMany persistent: true option
...
When set, instead of only embedding the model (on creation) it will be
persisted first, and subsequently embedded.
2014-09-07 12:59:47 +02:00
Fabien Franzen
ef816d490a
More tests for embedsMany with persistent model
2014-09-07 12:44:45 +02:00
Fabien Franzen
4c6f35d23d
Only check id as part of embedsMany relation
2014-09-07 12:17:42 +02:00
Fabien Franzen
a815ad0c1a
Test .value() method - as used by scope getter
2014-09-04 21:57:18 +02:00
Fabien Franzen
433b89a78a
embedsMany - implement sync scope getter
2014-09-04 21:51:59 +02:00
Fabien Franzen
92a76d3edb
hasAndBelongsToMany - test sync scope getter
2014-09-04 21:30:41 +02:00
Fabien Franzen
80b71438a7
polymorphic hasMany - test sync scope getter
2014-09-04 21:29:21 +02:00
Fabien Franzen
e502bd4459
hasOne - test sync scope getter
2014-09-04 21:27:40 +02:00