Clark Wang
4d5f3835bb
Fix typo of keyThrough and get from params
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-02 21:57:24 +08:00
Clark Wang
0cbc15c631
Remove unnecessary console.log
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-02 12:55:52 +08:00
Fabien Franzen
f31a9b13be
Updated embedded relations to use transient connector
...
embedsMany will now use a connector's generated method, when defined.
Also, the id property type is now inferred correctly, making the autoId
option obsolete. However, a new option, forceId, can be set to enforce
the use of auto-generated ids, preventing any explicitly (user-)set id
values.
2014-08-30 11:43:36 +02:00
Fabien Franzen
170dc661f4
Fix error messages, should be lowercase
2014-08-29 21:30:42 +02:00
Fabien Franzen
b27fd6527e
Use the correct dataSource for modelFrom/modelTo
2014-08-22 21:38:28 +02:00
Jaka Hudoklin
000c380a48
Emit deleted event on delete for embedsMany relations
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-08-22 16:02:01 +02:00
Raymond Feng
a43bed1f1b
Merge branch 'feature/to-one-update' of github.com:fabien/loopback-datasource-juggler into fabien-feature/to-one-update
2014-08-20 14:30:38 -07:00
Raymond Feng
f5839fb6ae
Merge branch 'feature/embeds-one' of github.com:fabien/loopback-datasource-juggler into fabien-feature/embeds-one
2014-08-20 14:28:45 -07:00
Raymond Feng
af329e3a66
Save the instance even the callback is not present
2014-08-20 14:22:47 -07:00
Fabien Franzen
20e5d3c01b
Validate embedded models by default
2014-08-20 08:58:08 -07:00
Fabien Franzen
1ec5357a6c
Implemented embedsOne
2014-08-20 08:58:08 -07:00
Fabien Franzen
af99a8d344
Implemented belongsTo update/destroy on scope
2014-08-20 16:46:54 +02:00
Fabien Franzen
12ebaf77f2
Implemented hasOne destroy()
2014-08-20 15:58:45 +02:00
Fabien Franzen
123b2558a1
Implemented hasOne update()
2014-08-20 15:54:47 +02:00
Fabien Franzen
1d5079d811
Implement update() on embedsOne scope
2014-08-20 15:37:40 +02:00
Fabien Franzen
a446551a59
Fix relations for RDBMS connectors (mysql, postgresql)
...
- fix tests (explicit model/property definitions)
- fix include vs. RDBMS model strictness
2014-08-20 14:03:38 +02:00
Fabien Franzen
6f815526b0
Validate embedded models by default
2014-08-19 22:15:30 +02:00
Fabien Franzen
7c901af6d9
Implemented embedsOne
2014-08-19 22:10:35 +02:00
Raymond Feng
c3c2907248
Merge pull request #224 from fabien/fix/ldl-polymorphic
...
Properly handle LDL for polymorphic relations
2014-08-16 08:15:09 -07:00
Fabien Franzen
b4b1c784dd
HasMany exists should use internal findById
...
This limits the scope correctly, taking polymorphics into account.
(the foreign key check is actually obsolete I think)
2014-08-16 13:04:13 +02:00
Fabien Franzen
ad780604e1
Properly handle LDL for polymorphic relations
2014-08-16 11:03:16 +02:00
Fabien Franzen
0e348b0333
Fixed duplicate code
2014-08-15 18:51:19 +02:00
Fabien Franzen
6b0bbed780
Merge branch 'fix/relation-tests' of https://github.com/fabien/loopback-datasource-juggler into fix/relation-tests
2014-08-15 18:43:20 +02:00
Fabien Franzen
96a276a12b
Refactor embedsMany - auto-save parent
...
With this change, saving an embedded model now correctly updates the
parent model.
Before, a separate `save()` call on the parent was required, contrary
to other relation types.
2014-08-15 18:40:33 +02:00
Fabien Franzen
8193f402bb
Refactor polymorphic relations, fix inverse #215
...
See #215 - when creating a related item through a the inverse of a
polymorphic HABTM relation,
the through-model was not created correctly. By refactoring the
specifics into the `polymorphic`
property of a RelationDefinition, it's now possible to handle this
correctly.
2014-08-15 18:35:31 +02:00
Fabien Franzen
78e2c9c9d4
Clarified tests, fixed BelongsTo.prototype.create
...
Added clarified test-case based on previous documentation example.
Fixed BelongsTo.prototype.create - although the foreignKey was set on
the model instance,
it was never actually persisted, unless you'd issue a separate call to
save the 'parent' model.
2014-08-15 18:35:31 +02:00
Raymond Feng
d7900a8a21
Merge pull request #211 from fabien/fix/relationTypes
...
Fix relationTypes
2014-08-15 09:29:22 -07:00
Raymond Feng
da4482d1cf
Merge pull request #213 from fabien/feature/scope-rel-methods
...
Implement scope.defineMethod/relation.defineMethod
2014-08-15 09:24:24 -07:00
Fabien Franzen
c2f9ee381c
Implement embedded.destroy() integration
2014-08-15 15:24:00 +02:00
Fabien Franzen
21801058c9
Refactor embedsMany - auto-save parent
...
With this change, saving an embedded model now correctly updates the
parent model.
Before, a separate `save()` call on the parent was required, contrary
to other relation types.
2014-08-15 15:12:02 +02:00
Fabien Franzen
c3c2c85ce4
Refactor polymorphic relations, fix inverse #215
...
See #215 - when creating a related item through a the inverse of a
polymorphic HABTM relation,
the through-model was not created correctly. By refactoring the
specifics into the `polymorphic`
property of a RelationDefinition, it's now possible to handle this
correctly.
2014-08-15 12:55:10 +02:00
Fabien Franzen
35850f6632
Clarified tests, fixed BelongsTo.prototype.create
...
Added clarified test-case based on previous documentation example.
Fixed BelongsTo.prototype.create - although the foreignKey was set on
the model instance,
it was never actually persisted, unless you'd issue a separate call to
save the 'parent' model.
2014-08-15 11:28:25 +02:00
Fabien Franzen
cd3ad32bb7
Fix formatting
2014-08-14 20:12:17 +02:00
Fabien Franzen
7d847f25dc
Fix scopeMethods closure issue
2014-08-14 20:12:17 +02:00
Fabien Franzen
a67759dcbf
Refactored embedsMany (relationName vs. propertyName)
2014-08-14 20:12:16 +02:00
Fabien Franzen
807a6aaf3f
Refactor modelTo logic into lookupModelTo
2014-08-14 19:43:30 +02:00
Fabien Franzen
710ad35b39
Implement scope.defineMethod/relation.defineMethod
2014-08-13 11:28:23 +02:00
Fabien Franzen
93fab448bc
Tiny fix: use setAttributes
2014-08-11 13:03:51 +02:00
Raymond Feng
3d5ec63c99
Pass options into scope
2014-08-08 09:25:49 -07:00
Fabien Franzen
ef65ffee48
Changed normalization api - enabled hasOne remoting
2014-08-01 11:24:41 +02:00
Fabien Franzen
090c738bb5
Correctly handle remoting of scope methods
2014-07-30 17:30:21 +02:00
Fabien Franzen
af0ca5b108
Handle remoting of custom scope methods
2014-07-30 16:46:05 +02:00
Fabien Franzen
e38c92af87
ReferencesMany fixes after LB integration tests
2014-07-30 15:01:55 +02:00
Fabien Franzen
5cee6a4b79
Fixed embedsMany after LB integration
2014-07-30 13:22:20 +02:00
Raymond Feng
7a9b64f1bf
Fix the test failure for mongodb
2014-07-29 22:19:52 -07:00
Fabien Franzen
e888b8cff9
Allow custom scopeMethods option (obj/fn) for relation scopes
2014-07-29 22:59:44 +02:00
Fabien Franzen
06f2b32c21
Renamed EmbedsMany 'reference' option to 'belongsTo'
2014-07-29 21:56:59 +02:00
Fabien Franzen
1782b439f1
Implemented referencesMany
2014-07-29 21:46:12 +02:00
Fabien Franzen
60fd39d311
Added option: reference to enable embedsMany add/remove
2014-07-29 17:43:30 +02:00
Fabien Franzen
b18384459a
Implemented findByIds
2014-07-29 15:01:47 +02:00