Raymond Feng
e9f00fbd8b
Add neq operator support for memory connector
...
See https://github.com/strongloop/loopback-datasource-juggler/issues/265
2014-08-29 08:45:45 -07:00
Raymond Feng
32313c1df9
Make sure timeout handle is cleared
2014-08-27 09:42:16 -07:00
Raymond Feng
fde5b426e4
Make sure error events are emitted by data source
2014-08-27 09:14:17 -07:00
Fabien Franzen
6fae8c7277
Remove iteration of config args
...
Fixes #154 - args should only contain the property name at that point,
not loop over it.
2014-08-26 18:01:23 +02:00
Fabien Franzen
86ea107550
Validations configuration as object
...
Previously validations were appended to an array when configured. The
format was cumbersome, and led to issues. This refactors the
configuration into an object, as a property of the Model.
Note that if no validations have been configured, this property is
currently `undefined`.
2014-08-26 17:51:01 +02:00
Fabien Franzen
73330113ae
Applied Coobaha's PR fix - prevents undefined values
2014-08-26 17:15:07 +02:00
Fabien Franzen
bed97a75cb
Expose validation metadata
...
The new Validatable.validations mixin method returns the validations as
an object
indexed by property name.
2014-08-26 16:56:09 +02:00
Fabien Franzen
a4db887493
Implement where arg on scoped count and destroyAll
2014-08-26 14:54:19 +02:00
Fabien Franzen
b27fd6527e
Use the correct dataSource for modelFrom/modelTo
2014-08-22 21:38:28 +02:00
Raymond Feng
ce12db3e45
Merge pull request #250 from offlinehacker/embedsMany_deleted
...
Emit deleted event on delete for embedsMany relations
2014-08-22 11:05:21 -07:00
Raymond Feng
0f3e7d50bd
Merge pull request #239 from strongloop/feature/add-ping
...
Add ping() to test connections
2014-08-22 09:30:43 -07: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
fcd8ed984c
Make sure falsy value is kept for properties not predefined
2014-08-21 13:47:09 -07:00
Fabien Franzen
3f0380296a
Fix side-effects of PR #237 - see #242
2014-08-21 10:44:55 +02:00
Raymond Feng
3875c561e0
Add ping() to test connections
2014-08-20 16:31:23 -07: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
faed0510c1
Coerce embedded model types
2014-08-20 08:58:07 -07:00
Fabien Franzen
3b81b928fb
Implement DAO unsetAttribute
2014-08-20 08:57:20 -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
Fabien Franzen
2b262c04f6
Coerce embedded model types
2014-08-19 22:06:55 +02:00
Fabien Franzen
c19aca906d
Implement DAO unsetAttribute
2014-08-19 22:05:27 +02:00
Fabien Franzen
dad8266837
Prevent failure with null in List toObject
2014-08-18 07:28:33 +02:00
Raymond Feng
a6fe10e527
Merge pull request #226 from fabien/feature/multi-mixin
...
Add ability to apply a plugin multiple times from LDL
2014-08-17 22:18:05 -07:00
Fabien Franzen
291e7b2c74
Fix ModelDefinition toJSON bug
2014-08-17 18:01:52 +02:00
Fabien Franzen
39a728be84
Add ability to apply a plugin multiple times from LDL
2014-08-17 12:29:04 +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
315d5c15c6
Tiny fix: obsolete i8n require
2014-08-16 11:07:48 +02:00
Fabien Franzen
ad780604e1
Properly handle LDL for polymorphic relations
2014-08-16 11:03:16 +02:00
Raymond Feng
7f9108c6d2
Check null
...
See https://github.com/strongloop/loopback-datasource-juggler/issues/223
2014-08-15 23:30:23 -07:00
Fabien Franzen
3e300c1f35
Add strict flag to sortObjectsByIds
...
When true, any object not in the ids will be discarded and a subset
will be returned.
2014-08-15 19:47:12 +02:00
Fabien Franzen
9f1c5d9c37
Moved DataAccessObject.sortByIds to utils.js
2014-08-15 19:39:58 +02:00
Fabien Franzen
085bb94505
Allow partial list of ids for sortByIds
2014-08-15 19:39:58 +02:00
Raymond Feng
8743d75999
Merge pull request #222 from fabien/fix/relation-tests
...
Fixed duplicate code
2014-08-15 10:15:11 -07:00
Fabien Franzen
0e348b0333
Fixed duplicate code
2014-08-15 18:51:19 +02:00
Raymond Feng
03d94a86e5
Merge pull request #219 from fabien/fix/relation-tests
...
Fix BelongsTo.prototype.create + remaining issues with new relation types
2014-08-15 09:46:27 -07: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
Raymond Feng
62db2155e4
Merge pull request #212 from offlinehacker/relations_count
...
add count to relations
2014-08-15 09:37:50 -07: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
e22389967c
Merge pull request #214 from fabien/fix/scope-order
...
Allow runtime override of scope/relation order query param
2014-08-15 09:25:17 -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
7cd880712b
Handle toObject in updateAttributes
...
Since one can call updateAttributes with any kind of properties (as
opposed to save, which uses toObject internally), any objects that
correspond to toObject should be handled as such. This is particularly
the case with List objects, as used by embedsMany.
2014-08-15 18:01:40 +02: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
a243d05880
Enable DL definition of embedsMany + referencesMany
2014-08-14 20:12:16 +02:00
Fabien Franzen
807a6aaf3f
Refactor modelTo logic into lookupModelTo
2014-08-14 19:43:30 +02:00
Miroslav Bajtoš
12514b01d0
Merge pull request #210 from fabien/fix/embeds-many
...
Tiny fix: use setAttributes
2014-08-14 18:55:00 +02:00
Fabien Franzen
d7555bfb64
Allow runtime override of scope/relation order query param
2014-08-13 16:24:11 +02:00
Fabien Franzen
710ad35b39
Implement scope.defineMethod/relation.defineMethod
2014-08-13 11:28:23 +02:00
Jaka Hudoklin
0d44cdc573
add count to relations
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-08-12 14:44:33 +02:00
Rand McKinney
4cb22793e2
Fix links to confluence docs
2014-08-11 11:42:21 -07:00
Fabien Franzen
93fab448bc
Tiny fix: use setAttributes
2014-08-11 13:03:51 +02:00
Raymond Feng
c53dc74d16
Fix a name conflict in scope metadata
2014-08-08 15:52:30 -07:00
Raymond Feng
caff62d8b3
Merge branch 'fabien-feature/plugins'
2014-08-08 09:29:17 -07:00
Raymond Feng
3d5ec63c99
Pass options into scope
2014-08-08 09:25:49 -07:00
Raymond Feng
7fe7bf9b9a
Add scope definitions to the model class
...
See https://github.com/strongloop/loopback/issues/454
2014-08-08 09:01:24 -07:00
Raymond Feng
f671c9c726
Clean up the mixin processing
2014-08-08 01:20:57 -07:00
Raymond Feng
55ff28206f
Merge branch 'feature/plugins' of github.com:fabien/loopback-datasource-juggler into fabien-feature/plugins
2014-08-07 22:51:25 -07:00
Laurent
71398518ff
Fix bug when using multiple include keys
2014-08-06 20:40:24 +02:00
Fabien Franzen
35776311fd
Unified plugins into mixins
...
Mixin types: module function, module object, LDL json object.
2014-08-06 13:26:47 +02:00
Fabien Franzen
455ee9ec63
Fix typo: loadPlugin(s)
2014-08-05 16:28:17 +02:00
Fabien Franzen
f1f692a8a5
Minor touch-ups
2014-08-05 16:26:34 +02:00
Fabien Franzen
1a4e8863ef
Basic plugin architecture
...
Similar to http://mongoosejs.com/docs/plugins.html
Next, loopback-boot should be updated to support loading plugins from
dirs.
2014-08-05 16:16:10 +02:00
Raymond Feng
d07b716ae8
Merge pull request #200 from strongloop/feature/emit-events-during-attach
...
Emit dataAccessConfigured events during attach
2014-08-04 15:27:11 -07:00
Fabien Franzen
93aea7eb66
Changed options.path to option.http.path
2014-08-04 19:45:47 +02:00
Fabien Franzen
81a822524d
Removed normalization (see strong-remoting)
2014-08-04 12:17:06 +02:00
Raymond Feng
b9d9ab0fb3
Emit dataAccessConfigured events during attach
...
See discussions at https://github.com/strongloop/loopback/issues/410
2014-08-01 08:22:33 -07:00
Fabien Franzen
ef65ffee48
Changed normalization api - enabled hasOne remoting
2014-08-01 11:24:41 +02:00
Fabien Franzen
71bf0f8240
Customize/Normalize class-level remoting http path
2014-08-01 09:38:25 +02:00
Raymond Feng
6239d8fde5
Merge branch 'patch-4' of github.com:lchenay/loopback-datasource-juggler into lchenay-patch-4
2014-07-30 21:34:41 -07:00
Jaka Hudoklin
d896a0982e
fix datasources to support new model parameters
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-31 01:06:52 +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
Fabien Franzen
13cee9502c
Tests for polymorphic embedsMany
2014-07-29 13:57:49 +02:00