Clark Wang
565b85555c
Allow to add connection with through data for HasManyThrough relation
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-08-31 21:40:18 +08:00
Clark Wang
d43044c766
fix polymorphicName var scope
...
see https://github.com/strongloop/loopback-datasource-juggler/issues/271
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-08-31 19:57:37 +08:00
Fabien Franzen
3f517a4c0a
Reset json when building model definition
2014-08-31 12:17:53 +02:00
Fabien Franzen
0a9cb72837
Enable dynamic modelTo for scopes
...
This is especially useful for relations/prototype scopes, as it allows
you to dynamically deduce the target model from the current receiver
(model instance). This is an advanced option that should otherwise have
no effect on the previous/default functionality. Basically, the
targetClass is taken out of the closure and handled by a method called
targetModel now.
2014-08-30 20:58:06 +02: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
bd9895ebd6
Implemented Transient connector
2014-08-30 10:53:10 +02:00
Fabien Franzen
170dc661f4
Fix error messages, should be lowercase
2014-08-29 21:30:42 +02:00
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
Fabien Franzen
da303b72a5
Implemented more complex scenaro: embedsMany + relations
...
The test case will denormalize data into the embedded object,
and re-use the actual related object id as its own id.
2014-07-29 12:02:52 +02:00
Fabien Franzen
6ed7a0a5f2
Convenience embedsMany accessors: at(idx), get(id), set(id, data)
2014-07-29 10:51:33 +02:00
Raymond Feng
cb43114ab7
Fix test cases
2014-07-28 16:15:37 -07:00
Raymond Feng
1b44a6d779
Merge branch 'feature/embed-hasmany' of github.com:fabien/loopback-datasource-juggler into fabien-feature/embed-hasmany
2014-07-28 14:51:16 -07:00
Raymond Feng
75403ef929
Merge branch 'feature/polymorphic-rel' of github.com:fabien/loopback-datasource-juggler into fabien-feature/polymorphic-rel
...
Fix test cases
2014-07-28 14:22:45 -07:00
Raymond Feng
8bc11ca51e
Increase the max number of model listeners
...
See https://github.com/strongloop/loopback/issues/404
2014-07-28 13:02:00 -07:00
Raymond Feng
5221d12305
Remove unused data
2014-07-28 09:36:04 -07:00
Laurent Chenay
aaf037fc51
Do not overwrite inclusion but scope them. Needed in relation hasManyThrought
2014-07-28 15:20:04 +02:00
Laurent Chenay
04a56e2ea6
Fix HEAD on relation hasMany
2014-07-28 11:36:32 +02:00
Fabien Franzen
309105c4ad
Updated remaining relations to use polymorphicParams
2014-07-28 11:12:20 +02:00
Fabien Franzen
7ddfbb6409
polymorphics can now be declared using object
2014-07-28 10:44:26 +02:00
Fabien Franzen
4e76c2a77f
typeTo => discriminator
2014-07-28 10:18:42 +02:00
Fabien Franzen
e1ecb4b95f
Require unique ids for embedded items
2014-07-27 17:30:10 +02:00
Fabien Franzen
43e11af942
Test build of embedsMany
2014-07-27 17:16:25 +02:00
Fabien Franzen
cd2cc68905
Minor fix
2014-07-27 16:56:30 +02:00
Fabien Franzen
1487a592c1
Added validation for embedded items (optional)
2014-07-27 16:54:01 +02:00
Fabien Franzen
59a957b538
Implemented embedsMany relation
2014-07-27 16:30:45 +02:00
Raymond Feng
1a989041ed
Fix a regression where undefined id should not match any record
2014-07-27 00:38:50 -07:00
Fabien Franzen
5a5aa3f14d
Minor tweaks; pass-through properties/scope for hasAndBelongsToMany
2014-07-26 21:32:24 +02:00
Fabien Franzen
5e30ec8637
Implemented polymorphic hasMany through inverse
...
Added option invert: true to enable inverse polymorphic hasMany
relations.
Fixed missing fk1 in query of HasManyThrough.prototype.exists.
2014-07-26 21:11:25 +02:00
Fabien Franzen
d1896553fd
More hasAndBelongsToMany tests
2014-07-26 17:20:25 +02:00
Fabien Franzen
9f94ec9bde
Minor cleanup
2014-07-26 15:23:40 +02:00
Fabien Franzen
00dfe563eb
Implemented polymorphic hasOne
...
Signed-off-by: Fabien Franzen <info@atelierfabien.be>
2014-07-26 15:20:46 +02:00
Fabien Franzen
295e6fc1f1
Implemented polymorphic hasAndBelongsToMany
2014-07-26 14:54:54 +02:00
Fabien Franzen
9b97e1ae77
Implemented polymorphic hasMany
2014-07-26 12:47:55 +02:00
Miroslav Bajtoš
ebd0bc62ee
datasource: support connectors without `getTypes`
...
Asking connectors to provide `getTypes` function is a breaking
change, connectors working with loopback 1.3 no longer works
in newer versions.
2014-07-25 11:32:40 +02:00
Miroslav Bajtoš
cd4dba79dc
relation: add `scope._target` for `hasOne`
...
Add `_target` property to the scope method created by `hasOne`
relationship. The `_target` property is used by loopback-sdk-angular.
2014-07-24 20:22:11 +02:00
Fabien Franzen
973c96268f
Fix scoped destroyAll: only use 'where', not full 'filter' args
2014-07-24 15:55:00 +02:00
Fabien Franzen
687eb9888b
Added test for belongsTo scope/properties
...
Note: its seems that keyFrom and keyTo were mistakingly reversed in
BelongsTo.prototype.create, please double check. The added test cases
now pass with pk/fk switched.
2014-07-23 11:10:44 +02:00
Fabien Franzen
bc4076f35e
Implement scope/properties for BelongsTo (+ fix foreign key matching)
2014-07-22 22:09:29 +02:00
Raymond Feng
61d315cb28
Merge pull request #180 from strongloop/feature/refactor-relation-remoting
...
Move relation remoting to loopback
2014-07-22 11:13:07 -07:00
Raymond Feng
716b27b0f0
Merge pull request #181 from offlinehacker/master
...
Add support for disabling relationship includes
2014-07-21 13:46:43 -07:00
Jaka Hudoklin
11679beb14
add support for disabling relationship includes
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-21 22:39:29 +02:00
Jaka Hudoklin
b1a1894635
add support for relationship options
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-21 22:39:06 +02:00
Raymond Feng
8f46626c0b
Expose base model class as `base` property
2014-07-21 10:21:30 -07:00
Raymond Feng
ad22b025a6
Move relation remoting to loopback
2014-07-16 16:36:43 -07:00
Raymond Feng
fc710ca55a
Merge branch 'master' into 2.0
2014-07-15 17:09:20 -07:00
Raymond Feng
ee6da650e9
Test instance or id by the model type
2014-07-15 16:09:54 -07:00
Raymond Feng
dc6ada6348
Merge pull request #165 from strongloop/feature/allow-hook-skip-next
...
Pass callback to hooks so that next can be skipped
2014-07-15 12:53:52 -07:00
Raymond Feng
efeb59178f
Merge pull request #174 from fabien/fix/validations
...
Fix/validations
2014-07-15 12:53:33 -07:00
Raymond Feng
9325ce316b
Allow before hooks to pass arguments to next()
2014-07-15 12:51:33 -07:00
Raymond Feng
f3dbc6ca5f
Remoting methods for hasMany through
2014-07-15 08:50:34 -07:00
Raymond Feng
ae9c7f8cac
Fix the error message
2014-07-14 08:56:33 -07:00
Fabien Franzen
48c4f25b09
Renamed mapping to properties
2014-07-12 00:02:16 +02:00
Fabien Franzen
61f6d49518
Fix validateUniqueness/nextTick
2014-07-11 23:55:15 +02:00
Fabien Franzen
50656b8206
Handle custom error codes
...
Fixes #151
2014-07-11 23:03:07 +02:00
Fabien Franzen
a58dbe3a54
More validations and tests
...
Added validatesAbsenceOf. Handle async with if/unless prevention of
validators correctly. See: #170 #158
2014-07-11 22:56:02 +02:00
Fabien Franzen
5f1431aa05
Don't check uniqueness of blank values
2014-07-11 22:07:57 +02:00
Fabien Franzen
6aaa3f216e
RelationDefinition applyScope/applyMapping
...
Add the ability to set static/dynamic filtering (where, order, limit,
skip, fields …) and property mapping/transfer (de-normalization) for
hasMany/hasOne.
2014-07-11 15:29:47 +02:00
Raymond Feng
a37129bdff
Allows default model class to be configured
2014-07-08 14:04:20 -07:00
Samuel Reed
b66183f7dc
DAO.prototype.exists should return 'boolean' type.
...
Signed-off-by: Samuel Reed <samuel.trace.reed@gmail.com>
2014-07-08 15:51:24 -05:00
Miroslav Bajtoš
0296ef113d
Make sure 'deleteById' is used as the remote operation name
...
See strongloop/loopback#359
2014-07-03 08:17:01 +02:00
Raymond Feng
f7afade229
Make sure 'upsert' is used as the remote operation name
...
See https://github.com/strongloop/loopback/issues/359
2014-07-02 12:20:56 -07:00
Raymond Feng
e45834b454
Merge pull request #156 from strongloop/feature/fix-lb-353
...
Make sure type of the foreign key match the primary key
2014-06-27 10:08:54 -07:00
Raymond Feng
d0e61af26f
Merge pull request #157 from strongloop/feature/query-order
...
Normalize filter.order and enforce more checks
2014-06-27 10:01:33 -07:00
Raymond Feng
e0c7619908
Normalize filter.order and enforce more checks
2014-06-26 23:40:20 -07:00
Raymond Feng
4515491318
Make sure type of the foreign key match the primary key
...
See https://github.com/strongloop/loopback/issues/353
2014-06-26 23:38:04 -07:00
Ritchie Martori
a3ed1a575e
Add "hasOne" to relationTypes
2014-06-26 14:48:27 -07:00
Miroslav Bajtoš
3572ecd12d
validations: support non-V8 browsers
...
Call `Error.captureStackTrace()` only when it is available.
Use `this.stack = (new Error).stack` when `captureStackTrace` is not
available but the `stack` property is (Firefox).
2014-06-23 14:39:37 +02:00
Raymond Feng
ce8254125f
Merge branch 'master' into 2.0
2014-06-21 12:53:46 -07:00
Raymond Feng
3edee5c4c5
Work around for Date default
...
See https://github.com/strongloop/loopback-connector-postgresql/issues/15
2014-06-21 12:53:06 -07:00
Raymond Feng
332579ec87
Synchronize with cachedRelations
2014-06-21 11:44:33 -07:00
Raymond Feng
cbee68706f
Remove remoting metadata
2014-06-20 23:54:46 -07:00
Raymond Feng
44de2da21f
Merge branch 'master' into 2.0
2014-06-20 23:02:37 -07:00
Raymond Feng
3f7e85101d
Merge pull request #140 from strongloop/feature/refactor-relation
...
Feature/refactor relation
2014-06-20 20:56:44 -07:00
Raymond Feng
86073cb480
Merge pull request #144 from strongloop/feature/add-update
...
Feature/add update
2014-06-20 12:28:48 -07:00
Raymond Feng
a1836662a7
Clean up comments
2014-06-20 12:05:32 -07:00
Raymond Feng
27f4c1b7b4
Fix the error msg
2014-06-19 15:09:19 -07:00
Raymond Feng
1833352238
More clean up for the scope processing
2014-06-19 12:00:49 -07:00
Raymond Feng
177752e144
Add more jsdocs
2014-06-19 11:13:24 -07:00
Raymond Feng
26501eaa2e
Merge pull request #135 from albertoleal/ConvertNullToNotFoundError
...
ConvertNulltoNotFoundError when calling DataAccessObject.findOne via rest
2014-06-18 23:00:30 -07:00
Raymond Feng
7c71e1e53b
Merge pull request #141 from strongloop/feature/fix-perf
...
Feature/fix perf
2014-06-18 22:40:00 -07:00
Raymond Feng
085a0a1681
Merge pull request #143 from strongloop/feature/lb-issue-336
...
Allows skip or offset
2014-06-18 22:31:47 -07:00
Raymond Feng
888d15ce1c
Optimize model instantiation and conversion
2014-06-18 22:13:52 -07:00
crandmck
893768e895
Add hooks and include mixins
2014-06-18 16:42:00 -07:00
Raymond Feng
b3b29d7313
Enhance the wildcard to regexp conversion
2014-06-18 12:37:49 -07:00
Raymond Feng
a487eb57cd
Add like/nlike support for memory connector
2014-06-17 23:19:28 -07:00
Raymond Feng
ad3af82923
Add support for updating multiple instances with query
2014-06-17 16:30:02 -07:00
crandmck
4ff6e0d707
Minor JSDoc cleanup
2014-06-17 13:21:21 -07:00
crandmck
907163949e
Initial JSDoc cleanup
2014-06-17 13:18:18 -07:00
Raymond Feng
4b9d98c6ce
Allows skip or offset
...
See https://github.com/strongloop/loopback/issues/336
2014-06-17 09:07:55 -07:00
Raymond Feng
e2ab9ccc93
Adding back the remoting metadata
2014-06-16 13:46:17 -07:00
Raymond Feng
046816191d
Clean up scope implementation
2014-06-16 10:50:42 -07:00
Raymond Feng
2db43c58e5
Add support for hasOne
2014-06-16 01:17:37 -07:00
Raymond Feng
34c1998f04
Fix the hasMany through connection
2014-06-16 00:36:12 -07:00
Raymond Feng
1406c22a64
Refactor relation into classes
2014-06-15 15:53:58 -07:00
Raymond Feng
0c13f8c23a
Merge pull request #132 from strongloop/feature/memory-connector-comparator
...
Feature/memory connector comparator
2014-06-13 11:46:52 -07:00
crandmck
1787f5ec4f
Add properties and other doc cleanup
2014-06-11 15:47:44 -07:00
Alberto Leal
4fd3c969f9
Convert null to NotFoundError for remoting call to DataAccessObject.findOne.
2014-06-11 16:59:21 -03:00
Raymond Feng
bb57fcbe11
Fix the comparison for null/boolean values
2014-06-10 16:11:50 -07:00
crandmck
c355c99cbd
More JSDoc cleanup
2014-06-10 14:27:58 -07:00
Raymond Feng
6e8034ff93
Fix the forEach closure
2014-06-06 09:59:57 -07:00
Raymond Feng
e0d3fec743
Fix the typo
2014-06-06 09:10:47 -07:00
Raymond Feng
0191e3c2db
Add more tests
2014-06-06 08:48:05 -07:00
Raymond Feng
a0a9fae9c6
Enhance comparators for memory connector
2014-06-06 08:19:41 -07:00
Rand McKinney
04e1256b8b
Update datasource.js
...
Fix small typo
2014-06-04 17:44:57 -07:00
Raymond Feng
5f3c856d2e
Fix the logical operator check
2014-06-04 14:23:53 -07:00
Raymond Feng
cdf9956867
Fix JS doc for private methods
2014-06-04 14:02:55 -07:00
Raymond Feng
42c1ad3dca
Normalize/validate the query filter object
2014-06-02 15:57:44 -07:00
Raymond Feng
3e8284d1ee
Use connector's buildWhere to implement count
2014-06-02 15:57:06 -07:00
Rand McKinney
653aab856c
JSDoc improvements
...
Improve createModel doc, Fix some other minor issues.
2014-05-29 15:33:01 -07:00
Miroslav Bajtoš
d8b4f5833a
ModelBuilder: add `prototype.defineValueType`
...
Add a shortcut for registering a new value type.
The current implementation registers the type in the singleton registry
`ModelBuilder.schemaTypes`.
The API should allow us to to change the implementation to register
the type in the scope of ModelBuilder instance only.
2014-05-29 11:57:59 +02:00
Miroslav Bajtoš
a86648ed7b
Replace connector base with loopback-connector
...
Remove references to Connector and BaseSQL, connectors should require()
loopback-connector instead of loopback-datasource-juggler.
2014-05-29 11:57:49 +02:00
Miroslav Bajtoš
9b33d9a274
Remove unsupported connectors
...
- cradle
- http
- neo4j
- riak
2014-05-28 19:49:07 +02:00
Raymond Feng
97b1501c1f
Keep undefined/null values for the array type
...
This allows connectors to distinguish between empty array and
undefined/null. For example, mongodb will not override existing array
properties if the value is undefined.
2014-05-27 21:59:21 -07:00
crandmck
83979cad7a
Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst)
2014-05-27 21:59:21 -07:00
crandmck
835708d25d
Copy info from api-model.md to JSDoc
2014-05-27 21:59:21 -07:00
Miroslav Bajtoš
65fa7a1c00
validations: include more details in `err.message`
...
Modify ValidationError constructor to include the model name and
a human-readable representation of the validation errors (messages)
in the error message.
Before this change, the message was pointing the reader
to `err.details`. Most frameworks (e.g. express, mocha) log only
`err.message` but not other error properties, thus the logs were
rather unhelpful.
Example of the new error message:
The `User` instance is not valid. Details: `name` can't be blank.
2014-05-27 21:59:21 -07:00
Raymond Feng
050353f11d
Keep undefined/null values for the array type
...
This allows connectors to distinguish between empty array and
undefined/null. For example, mongodb will not override existing array
properties if the value is undefined.
2014-05-27 13:18:21 -07:00
crandmck
5937f0c0d5
Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst)
2014-05-22 15:02:57 -07:00
crandmck
00226dde0d
Copy info from api-model.md to JSDoc
2014-05-21 17:50:44 -07:00
Ritchie Martori
69b0355fa7
Merge pull request #115 from strongloop/refactor/remove-remoting
...
Remove remoting metadata
2014-05-20 13:59:33 -07:00
Ritchie Martori
8849a4b49a
!fixup Remove additional remoting
2014-05-20 13:48:23 -07:00
Ritchie Martori
e724efd95f
!fixup Require ._delegate for fn override
2014-05-20 13:44:25 -07:00
Ritchie Martori
072999775e
Remove relation remoting
2014-05-20 12:47:14 -07:00
Miroslav Bajtoš
05410d56e1
validations: include more details in `err.message`
...
Modify ValidationError constructor to include the model name and
a human-readable representation of the validation errors (messages)
in the error message.
Before this change, the message was pointing the reader
to `err.details`. Most frameworks (e.g. express, mocha) log only
`err.message` but not other error properties, thus the logs were
rather unhelpful.
Example of the new error message:
The `User` instance is not valid. Details: `name` can't be blank.
2014-05-20 11:00:19 +02:00
Ritchie Martori
dc9c9b2bd4
Remove remoting metadata
2014-05-16 12:33:17 -07:00
Raymond Feng
981185f4c0
Merge pull request #112 from strongloop/feature/logical-operator
...
Add support for logical operator (AND/OR)
2014-05-16 08:46:25 -07:00
Adam Schwartz
49f0e5dcee
Fix typo "Unkown" => "Unknown"
2014-05-15 23:26:17 -04:00
crandmck
ba3653d406
Updated JSDoc comments with content from .md file
2014-05-15 17:59:23 -07:00
Raymond Feng
8f9dc1b867
Add support for logical operator (AND/OR)
2014-05-15 08:56:00 -07:00
Miroslav Bajtoš
2a74bdc4de
validations: support multi-key unique constraint
...
Modify the "unique" validator to accept additional property names to
narrow the space of rows searched for duplicates.
Example:
Consider `SiteUser` belongsTo `Site` via `siteId` foreign key.
Inside every site, the user email must be unique. It is allowed to
register the same email with multiple sites.
SiteUser.validateUniquenessOf('email', { scopedTo: ['siteId'] });
2014-05-15 09:15:44 +02:00
crandmck
1db35cc926
Update JSDoc comments with content from api-model.md
2014-05-14 18:30:42 -07:00
Rand McKinney
affe3cd943
Add JSDoc for lat and lng properties.
2014-05-14 16:34:24 -07:00
Ritchie Martori
2922eb63b7
Merge
2014-05-14 13:33:46 -07:00
Ritchie Martori
ad752747d3
Add missing changed event
2014-05-14 13:31:15 -07:00
Ritchie Martori
6c91201f79
Local Storage
2014-05-14 13:31:15 -07:00
Ritchie Martori
0866a55cb2
Do not .toObject if already Object
2014-05-14 13:31:15 -07:00
Zack Bloom
dd4089d1c7
Fix bug where invalid relations in include filters would hang the server
2014-05-13 13:59:15 -04:00
Raymond Feng
3f410cae21
Add test cases for updateOrCreate/save and fix related issues
2014-05-09 15:27:45 -07:00
Raymond Feng
0bcbe6ceae
Remove undefined for the data to be saved
2014-05-09 09:59:34 -07:00
Raymond Feng
4a907b0a18
Remove the undefined property to avoid mongodb upsert overwrite
2014-05-08 15:46:39 -07:00
Raymond Feng
8b128b566d
Make sure ObjectID type is not parsed as object
2014-05-08 15:46:14 -07:00
crandmck
cf75f55f73
Fix JSDoc - remove newlines from function alias declarations, etc.
2014-05-07 11:24:49 -07:00
Rand McKinney
a765ea31ab
Correct JSDoc for discoverModelDefinitions
2014-05-06 14:18:10 -07:00
Ritchie Martori
45eadabbeb
Fix remoting for IDs in URLs
2014-05-01 14:19:31 -07:00
Ritchie Martori
aea5836569
Add hidden property support
2014-04-11 11:39:57 -07:00
Miroslav Bajtoš
440dfaf3a7
scope-like remotable metadata for belongsTo
...
Modify the methods created by `belongsTo` relation to mimick the methods
created by scopes (e.g. via `hasMany` relation).
This allows client code generators like loopback-angular to use the same
code for all relation types.
2014-04-08 10:30:57 +02:00
Raymond Feng
a1f8919e13
Merge pull request #98 from strongloop/feature/fix-issue-97
...
Fix the method for belongsTo with correct receiver
2014-04-04 08:27:55 -07:00
Raymond Feng
68d2696248
Fix the method for belongsTo with correct receiver
2014-04-03 20:41:53 -07:00
Miroslav Bajtoš
d08c6714d8
scope: improve description of shared methods
...
The description is used by client SDK code-generators like
loopback-angularjs.
2014-04-03 09:19:06 +02:00
Miroslav Bajtoš
abf57ff497
scope: add _targetClass to scope property
...
Store the class of the results returned by a scope find method.
This class is different from the "targetClass" when the relations
is using a third "through" model (e.g. hasAndBelongsToMany).
2014-04-02 19:32:37 +02:00
Raymond Feng
c79d0b0c33
Merge pull request #92 from strongloop/feature/fix-issue-91
...
Fix the base sql connector to correct escape id values
2014-03-27 14:34:46 -07:00
Raymond Feng
c28546b629
Fix the base sql connector to correct escape id values
...
This is based on https://github.com/strongloop/loopback-datasource-juggler/pull/91
https://github.com/strongloop/loopback-datasource-juggler/issues/90
2014-03-24 14:56:52 -07:00
Raymond Feng
0e7acec591
Set the relation property correctly
...
See https://github.com/strongloop/loopback/issues/218
2014-03-23 21:07:04 -07:00
Raymond Feng
cc5975486d
Simplify the inclusion processing
2014-03-17 08:40:40 -07:00
Raymond Feng
cadacc44bb
Create scoped methods for belongsTo and improve docs
2014-03-17 08:40:40 -07:00
Raymond Feng
1dc0c34252
Fix the connector resolver to make sure known connectors are used
2014-03-17 08:32:37 -07:00
Raymond Feng
bef90bd529
Refactor the serialize/deserialize into two functions
2014-03-17 08:32:37 -07:00
crandmck
aa11aad298
Fix some small errors
2014-03-13 16:26:29 -07:00
crandmck
9c2098cd35
Updates to JSDoc comments for API doc
2014-03-12 16:28:46 -07:00
Raymond Feng
464d23891b
Merge pull request #82 from strongloop/feature/ldl-scopes
...
Allows scopes to be defined in LDL
2014-03-04 09:50:27 -08:00
Raymond Feng
d14c58775d
Use debug module for logging
2014-03-04 09:42:55 -08:00
Raymond Feng
ab8076d44a
Merge pull request #80 from strongloop/feature/remoting-belongsTo
...
Make the belongsTo relation remotable
2014-03-04 08:57:57 -08:00
Raymond Feng
ed7e2e2ada
Fix the parameter name
2014-03-04 08:56:16 -08:00
Raymond Feng
24c4381221
Allows scopes to be defined in LDL
2014-03-03 17:16:37 -08:00
Raymond Feng
510f5ef6ac
Check the Array type
...
See https://github.com/strongloop/loopback-connector-mongodb/issues/21
2014-03-03 15:52:49 -08:00
Raymond Feng
14745b1305
Make the belongsTo relation remotable
2014-03-03 15:03:05 -08:00
Raymond Feng
925402fdb6
Merge pull request #78 from pandaiolo/master
...
Fix, model builder setter will not try to cast value if already the proper type
2014-02-27 10:38:28 -08:00
Aurelien Chivot
dfe1ea1655
Fix, model builder setter will not try to cast value if already the proper type
2014-02-26 21:10:15 +01:00
Raymond Feng
44a62d01af
Allows unknown properties to be saved for non-strict models
...
See https://github.com/strongloop/loopback/issues/199
2014-02-24 18:38:45 -08:00
Ritchie Martori
8ae292539e
Merge pull request #74 from strongloop/feature/dao-override
...
Override existing methods when mixing in DAO methods
2014-02-21 09:04:52 -08:00
Ritchie Martori
dd597d2197
Refactor mixin and always redefine proxy/delegate methods
2014-02-20 17:25:07 -08:00
Ritchie Martori
38c7a16da2
Override existing methods when mixing in DAO methods
2014-02-19 17:10:56 -08:00
Raymond Feng
9192c27409
Leave the item type introspection for List
2014-02-14 11:21:30 -08:00
Raymond Feng
12a624d99c
Rewrite the List class for typed array
2014-02-14 10:41:00 -08:00
Raymond Feng
7e45a1fda1
Fix the include with array value
2014-02-14 10:40:45 -08:00
Raymond Feng
061b274055
Merge branch 'partial-fix-for-58' of github.com:arlaneenalra/loopback-datasource-juggler
2014-02-12 21:55:53 -08:00
Raymond Feng
dbd97eb423
Merge pull request #68 from strongloop/feature/fix-lb-162
...
Make sure own properties are copied by toObject for non-strict mode
2014-02-11 14:29:21 -08:00
Raymond Feng
85232f31b3
Clean up the options for model constructor
2014-02-10 22:38:59 -08:00
arlaneenalra
5252d0e805
Move new var into thunk.
...
There really was no reason for it to be in the
outer context.
2014-02-05 22:21:27 -06:00
arlaneenalra
abd46961da
Use type converted data when writing back to database.
...
This allows foreignKey types and other custom types
to be converted into natvie values before writing them
to the database.
2014-02-04 23:10:42 -06:00
Raymond Feng
1961fbeefe
Enhance the assertions
2014-02-03 20:52:01 -08:00
Ritchie Martori
61a54da418
Merge pull request #65 from strongloop/feature/change-hook
...
Add change / delete events
2014-01-30 13:54:47 -08:00
Raymond Feng
ee5b351398
Make sure own properties are copied by toObject for non-strict mode
...
See https://github.com/strongloop/loopback/issues/162
2014-01-30 11:51:34 -08:00
Raymond Feng
da571c0c23
Use String[] for types and add test for supported types
2014-01-29 17:19:07 -08:00
Raymond Feng
cf200a2e27
Add getType/getDefaultIdType from connectors
2014-01-29 17:19:07 -08:00
Raymond Feng
e65d21dcdb
Merge pull request #67 from strongloop/feature/memory-persistence
...
Add an option for the memory connector to persist model instances
2014-01-29 17:18:00 -08:00
Raymond Feng
130dcdb582
Fix the write closure to use the correct task info
2014-01-29 13:41:42 -08:00
Raymond Feng
6b535f5d1c
Add a file option for the memeory connector to persist data
2014-01-29 12:04:09 -08:00
Ritchie Martori
e909749455
Add tests for change / delete events
2014-01-29 11:03:04 -08:00
Raymond Feng
c008c4d30a
Add more comments
2014-01-28 23:01:11 -08:00
Raymond Feng
2a57a909f0
Clean up lookupModel
2014-01-28 18:00:12 -08:00
Raymond Feng
43637a690d
Handle hasMany.though
2014-01-28 17:59:59 -08:00
Ritchie Martori
bef1bc1ca4
Add change / delete events
2014-01-28 13:51:45 -08:00
Raymond Feng
93c18163c8
Make sure __cachedRelations is not enumerable
2014-01-28 09:57:23 -08:00
Raymond Feng
1339250c8f
Promote the included relations as properties
2014-01-27 15:56:04 -08:00
Raymond Feng
2b8c1ebaee
Reformat the code
2014-01-24 09:09:53 -08:00
Raymond Feng
58a06272c3
Merge pull request #61 from strongloop/feature/fix-foreign-key
...
Use the primary key type for the generated foreign key
2014-01-24 08:31:02 -08:00
Raymond Feng
c374cc89cd
Use the primary key type for the generated foreign key
2014-01-21 09:47:32 -08:00
Miroslav Bajtoš
dbb7c6d9ae
Fill ModelClass.http.path
...
Set the HTTP route to `'/' + pluralModelName` so that we don't have
to duplicate this bit of logic in strong-remoting and other places.
2014-01-21 16:31:11 +01:00
Raymond Feng
2a50388894
Make the code testable following the review comments
2014-01-13 11:06:02 -08:00
Raymond Feng
acd02bf482
Allows the full module name for connectors
2014-01-09 17:03:37 -08:00
Raymond Feng
d9d9d82141
Add more comments
2013-12-20 17:49:14 -08:00
Raymond Feng
f1773857bb
Fix the remote delegation
2013-12-20 17:28:21 -08:00
Raymond Feng
1f965bfedb
Fix the remoting method with the current receiver (this)
2013-12-20 14:47:41 -08:00
Raymond Feng
e1ec152c78
Add models to LDL options
...
1. Use 'models' to specify the dependencies to other models
2. The 'models' property is an object, such as:
{
Model1: 'Model1',
Model2: Model2
}
3. The model classes will be injected into the newly defined class as
static properties using the keys from the models option.
2013-12-18 16:13:41 -08:00
Raymond Feng
aabe5fb1c4
Fix a bug in merging ACLs
2013-12-16 17:14:56 -08:00
Raymond Feng
3d9061aa69
Make the identation consistent for now
2013-12-16 08:40:06 -08:00
Raymond Feng
1b9edbcfcb
Fix a regression in mongodb connector
2013-12-15 22:51:47 -08:00
Raymond Feng
8d1d6f4466
Add more comments
2013-12-15 21:43:21 -08:00
Raymond Feng
9890af119e
Check for null & undefined values
2013-12-14 09:54:28 -08:00
Raymond Feng
fab504b5d9
Fix the coercion issue related to GeoPoint near
2013-12-14 09:49:11 -08:00
Raymond Feng
bf592413e1
Dedupe the alias methods during mixin
...
To prevent the same method from showing up multiple times in API explorer,
for example, Model.deleteById, Model.removeById
2013-12-13 16:45:31 -08:00
Ritchie Martori
749a494e53
Always call inherits to ensure prototypes are setup
2013-12-13 11:27:29 -08:00
Raymond Feng
441596b870
Merge pull request #47 from strongloop/feature/query-coercing
...
Coerce query values of where clause based on property types
2013-12-10 10:09:42 -08:00
Raymond Feng
29405976fb
Merge settings for base and sub models
2013-12-06 15:52:39 -08:00
Raymond Feng
2e4ed3f057
Merge pull request #48 from strongloop/feature/fix-discovery
...
Attach models to the data source
2013-12-05 15:40:43 -08:00
Raymond Feng
e5824356ca
Fix belongsTo relation
2013-12-04 21:38:40 -08:00
Raymond Feng
8360576c40
Attach models to the data source
2013-12-04 15:24:53 -08:00
Raymond Feng
52d2c8425f
Make all methods proxied for DAO
2013-12-04 13:44:25 -08:00
Raymond Feng
abe6d2bb22
Add more tests to address the PR comments
2013-12-04 10:00:33 -08:00
Raymond Feng
ed6d8839ba
Add a test case
2013-12-03 21:27:46 -08:00
Raymond Feng
a953ba13de
Clone shared methods so that they can be customized per model
2013-12-03 21:14:12 -08:00
Miroslav Bajtos
b5e0035d73
Improve properties of ValidationError
...
- change `statusCode` from 400 to 422
- nest `context` and `codes` inside `details`
- add `details.messages`
- reword the main error message
Remove the call to Error's constructor from ValidationError constructor,
because it's a no-op - Error's constructor creates a new
instance when called via `.call()`.
2013-12-02 21:35:47 +01:00
Raymond Feng
2df0c4b21d
Coerce types for values of where clause
2013-11-29 14:45:50 -08:00
Miroslav Bajtos
f7c48c0d72
REST call of DataAccessObject.findById returns 404
...
Modify the remoting configuration of `DataAccessObject.findById()`
and add a `rest.before` handler that converts `null` to 404 error.
The change is covered by a test in loopback project.
2013-11-21 19:05:52 +01:00
Raymond Feng
8d9d73efff
Add properties/methods to DataSource from ModelBuilder
2013-11-20 10:56:48 -08:00
Raymond Feng
a53eac5307
Merge pull request #42 from strongloop/feature/fix-ds-attach
...
Fix the model attachment to data source
2013-11-19 10:56:55 -08:00
Raymond Feng
2bcdea76f5
Fix the model attachment to data source
2013-11-19 10:49:54 -08:00
Raymond Feng
05eae4aa3e
Replace all with find to make it consistent
2013-11-18 11:39:07 -08:00
Raymond Feng
995a2139c8
Rename association to relation
2013-11-15 20:29:20 -08:00
Raymond Feng
7f6398f4c5
Fix the reference to modelBuilder/dataSource
2013-11-15 13:54:15 -08:00
Raymond Feng
b5e0f14249
Separate the modelBuilder ref from dataSource
2013-11-15 11:12:33 -08:00
Raymond Feng
526d126e41
Fix the relation lazy setup
2013-11-11 22:06:43 -08:00
Raymond Feng
275bb6ffac
Stop overwriting the static methods
2013-11-11 22:05:50 -08:00
Raymond Feng
ec7f79e935
Ensure the model is attached to DataSource for relations
2013-11-09 22:16:32 -08:00
Raymond Feng
7aa2eefec4
Remove inheritence from DataSource to ModelBuilder
2013-11-08 17:13:00 -08:00
Raymond Feng
0b899b0542
Allow settings.base to specify the base model
2013-11-07 17:11:17 -08:00
Raymond Feng
580ce14f0d
Extract the relation types
2013-11-07 13:30:54 -08:00
Raymond Feng
566da386ae
Refactor the relation handling and enable it with attach
2013-11-07 13:09:09 -08:00
Raymond Feng
34107a6a26
Redefine the existing class if it's resolved
2013-11-06 14:00:22 -08:00
Raymond Feng
68cf633795
Add support for hasMany-through and more tests
2013-11-05 09:29:24 -08:00
Raymond Feng
4fbec288c4
Enable deferred type/relation resolutions
2013-11-04 22:53:02 -08:00
Ritchie Martori
65bb5c8ead
Merge pull request #33 from strongloop/get-datasource
...
Remove model.dataSource property / Add model.getDataSource() method
2013-10-31 14:50:56 -07:00
Ritchie Martori
597a775e4c
Add model.getDataSource() method
2013-10-31 11:46:12 -07:00
Raymond Feng
d0055d8591
Fix removeUndefined to bypass non-plain objects
...
traverse.map() transform custom objects such as Date or ObjectID into
plain objects and it breaks the BSON serialization
2013-10-29 22:16:43 -07:00
Raymond Feng
dff3367f3a
Fix the regression when 1st arg is the connector module
2013-10-29 13:04:23 -07:00
Raymond Feng
37ced0111e
Merge pull request #30 from strongloop/ds-url
...
Support datasource/connector configuration using URL string
2013-10-28 10:58:45 -07:00
Raymond Feng
24e93248d1
Merge pull request #29 from strongloop/scope-remoting
...
Create remote functions for predefined scopes/relations
2013-10-27 12:59:57 -07:00
Raymond Feng
8ad0194a51
Add a relation example following Ruby on Rails active records
2013-10-27 12:55:01 -07:00
Raymond Feng
2ae0fd8804
Honor the model plural name
2013-10-25 16:25:05 -07:00
Raymond Feng
f3011216b5
Support datasource/connector configuration using URL string
2013-10-25 16:18:02 -07:00
Raymond Feng
c3d7fd0f1c
Create remote functions for predefined scopes/relations
2013-10-24 20:37:43 -07:00
Raymond Feng
fc2a53562e
Check undefined/null data
2013-10-24 18:43:55 -07:00
Raymond Feng
8a615324d0
Merge pull request #25 from strongloop/ds-attach
...
Fixes for data source juggler
2013-10-23 11:28:14 -07:00
Raymond Feng
32dbe9cb21
Move resolveType to ModelBuilder
2013-10-17 14:23:29 -07:00
Ritchie Martori
fcb35cc3eb
Fix prototype mixin bug
2013-10-11 18:37:45 -07:00
Raymond Feng
dd936b15a2
Make sure model definition is built when attaching to a DS
2013-10-11 16:35:17 -07:00
Raymond Feng
9ec9f654c7
Remove undefined values from the query object
2013-10-11 11:50:00 -07:00
Raymond Feng
aed3fb0e06
Log more information for the connection failure
2013-10-11 11:48:12 -07:00
Raymond Feng
64f57a2297
Handle connection errors
2013-10-10 22:47:26 -07:00
Ritchie Martori
95c14fa97d
Fix EventEmitter mixin
2013-10-08 15:48:17 -07:00
Raymond Feng
b8f94f5777
Make sure foreign key properties are fully registered
2013-10-07 18:01:31 -07:00
Raymond Feng
0bfc362b18
Use for-in loop to support properties from the super class
2013-10-06 21:27:02 -07:00
Raymond Feng
931636eda4
Allow the id(s) to be redefined by subclass
2013-10-06 21:13:52 -07:00
Raymond Feng
294ebc1ccf
Allow to reference a model as type by name
2013-10-05 11:13:10 -07:00
Raymond Feng
2f575482c0
Code clean up
2013-10-05 10:53:13 -07:00
Raymond Feng
7f170a0542
Add more tests and fix toJSON
2013-10-04 21:21:12 -07:00
Raymond Feng
2a15bb917a
Fix the foreign key definition
2013-10-04 15:49:13 -07:00
Raymond Feng
409d256e47
Add settings property back to the model class
2013-10-04 15:48:39 -07:00
Raymond Feng
24d87976e8
Merge branch 'master' into juggler-tidyup
...
Conflicts:
lib/model.js
2013-10-04 14:32:51 -07:00
Raymond Feng
04bda5c138
Set name and settings
2013-10-04 12:54:14 -07:00
Raymond Feng
ee426b63fc
Reset _ids for rebuild
2013-10-04 12:41:01 -07:00
Raymond Feng
1ae9478496
Fix the columnName
2013-10-03 14:49:03 -07:00
Raymond Feng
d0cdbd84ea
Use super_ to call the base class
2013-10-03 09:14:24 -07:00
Raymond Feng
691743493c
Fix copy of model definitions
2013-10-02 17:20:54 -07:00
Raymond Feng
1963ea9fb1
Use ModelDefinition to access model name/properties/settings
2013-10-02 15:18:50 -07:00
Raymond Feng
fad6ee5e1d
Refactor/cleanup the data source juggler implementation
...
- Add a ModelDefinition class to encapsulate the model schema handling
- Add a Connector class as the base class for connector implementations
- Optimize attachTo and mixin
- Rename some properties/methods
2013-10-01 22:14:21 -07:00
Raymond Feng
92cd7d15a6
Add a ModelDefinition class
2013-09-20 22:22:49 -07:00
Raymond Feng
1575c87caf
Make sure schemaless property value is honored over __data
2013-09-18 16:34:52 -07:00
Raymond Feng
bf223320ea
Allow connector to report failure during initialization
2013-09-12 13:32:53 -07:00
Raymond Feng
f4d62e54e6
Add error stack trace for ValidationError
...
The issue was initially reported by SLA-370.
2013-09-09 10:12:12 -07:00
Raymond Feng
21e6fddf1a
Check the filter param to make sure we have a default value
...
sls-sample-app is failing if we hit http://localhost:3000/locations/findOne
In this case, a undefined param is passed in.
The fix now sets it to {} if the value is undefined/null
2013-09-06 13:42:12 -07:00
Raymond Feng
038f30cb95
Fix the conflicts between MongoDB _id & juggler's internal prefix
2013-08-30 16:59:17 -07:00
Raymond Feng
bfcd850dfe
Merge pull request #8 from strongloop/id-fix
...
Allows custom name of the id property for the memory connector
2013-08-30 10:59:50 -07:00
Raymond Feng
84a40cc1c6
Merge pull request #7 from strongloop/SLA-422
...
Mark id arguments to be required
2013-08-30 10:49:16 -07:00
Raymond Feng
f71dc8fe39
Set default value
2013-08-28 21:53:55 -07:00
Raymond Feng
c2eb1f55f0
Fix the property population for schemaless models
2013-08-28 21:49:05 -07:00
Raymond Feng
0866f33cec
Check the existence of id
2013-08-28 21:39:59 -07:00
Raymond Feng
6f111f8122
Allows custom name of the id property for the memory connector
2013-08-27 22:32:01 -07:00
Raymond Feng
cb00aad473
Mark id arguments to be required
2013-08-27 22:03:59 -07:00
Raymond Feng
59841a04a8
Set strict to false by default for non-relational data sources
2013-08-26 13:38:24 -07:00
Raymond Feng
ecc142b4d2
Disable remoting for reload
2013-08-26 10:54:26 -07:00
Raymond Feng
be15eabc36
Merge pull request #5 from strongloop/memory-connector-ids
...
Track the greatest id to prevent records from being overriden
2013-08-26 10:52:13 -07:00
Raymond Feng
7234c9822c
Add descriptions for remote method paramters
2013-08-23 17:04:08 -07:00
Raymond Feng
43a5398792
Fix the remote method descriptions
2013-08-23 14:08:47 -07:00
Raymond Feng
bede7ab499
Track the greatest id to prevent records from being overriden
2013-08-22 16:44:02 -07:00
Raymond Feng
6407098126
Update descriptions to use data source
2013-08-22 13:30:13 -07:00
Raymond Feng
a1e4457794
Refactor the shared method declaration and add descriptions
2013-08-22 12:24:02 -07:00
Raymond Feng
cf07563414
Fix the message
2013-08-20 16:14:27 -07:00
Raymond Feng
0fd167a41d
Use DEBUG or NODE_DEBUG env to override the debug flag
2013-08-18 23:11:32 -07:00
Raymond Feng
9482d3c7de
Fix the where option for delete
2013-08-18 10:58:53 -07:00
Raymond Feng
705a1fc2c9
Update the remote methods
2013-08-16 16:44:31 -07:00
Ritchie Martori
d5ab26509a
Merge pull request #1 from strongloop/id-fix
...
Fix the id references to allow custom name other than 'id'
2013-08-16 14:46:50 -07:00
Raymond Feng
29c95a4ec7
Remove the deletion of property type as the instane is shared by the base model class
2013-08-15 16:50:50 -07:00
Raymond Feng
281cc38017
Fix the id references to allow custom name other than 'id'
2013-08-14 23:14:44 -07:00
Raymond Feng
8aec0a3b47
Add missing declaration
2013-08-14 17:32:38 -07:00
Raymond Feng
6c0f2483b3
Update jsdocs
2013-08-13 09:37:27 -07:00
Raymond Feng
2e20df2dd3
Add docs.json and jsdocs
2013-08-09 15:16:32 -07:00
Raymond Feng
d3bf5c20ac
Add an optional models argument to automigrate/autoupdate
2013-08-08 08:30:26 -07:00
Raymond Feng
0a5c0ff77d
Refactor introspection to ModelBuilder
2013-08-07 14:51:32 -07:00
Raymond Feng
f3443959a1
Rename 'loopback-data' to 'loopback-datasource-juggler'
2013-07-30 14:10:03 -07:00
Raymond Feng
7ce6cfc9ab
Allows connector property to be a string
2013-07-30 10:52:30 -07:00
Ritchie Martori
08505d1e78
Add required validation
2013-07-28 13:17:12 -07:00
Raymond Feng
57c181c8b9
Bring up json object introspection to build models
2013-07-26 13:06:43 -07:00
Raymond Feng
0e4162af2a
Fix the constructor
2013-07-25 22:39:16 -07:00
Raymond Feng
1109f671da
Add precision/scale for sync discovery
2013-07-25 15:20:19 -07:00
Raymond Feng
dcada03c43
Add precision/scale
2013-07-25 15:06:00 -07:00
Raymond Feng
630aad2071
Refactor types out
2013-07-25 07:48:31 -07:00
Raymond Feng
adb724e3b2
Fix the ref to dataSource
2013-07-24 22:58:57 -07:00
Raymond Feng
9b422752a6
Allows non-strict mode to accept unknown properties
2013-07-24 22:58:57 -07:00
Raymond Feng
96787ad25f
Fix id references
2013-07-24 22:58:57 -07:00
Ritchie
5bf2d1ff23
Add root true to remote methods
2013-07-24 17:21:35 -07:00
Raymond Feng
752aedb80d
Rename adapters to connectors
2013-07-23 14:40:44 -07:00
Raymond Feng
ac76666b7b
Set up connector from the data source
2013-07-23 13:19:35 -07:00
Raymond Feng
1970c99424
Rename dataSource() to avoid conflicts with the property
2013-07-23 12:44:04 -07:00
Raymond Feng
4df5a02676
Fix schema references
2013-07-23 12:16:12 -07:00
Raymond Feng
9b169efc8c
Set up connector/adapter when postInit is not called
2013-07-23 12:05:08 -07:00
Raymond Feng
6af4b1ba2f
More renames: schema -> dataSource, adapter -> connector
2013-07-23 11:16:43 -07:00
Raymond Feng
127fb32d02
Add the id arg
2013-07-22 09:57:55 -07:00
Raymond Feng
b7f7f71b15
Add static deleteById
2013-07-22 09:42:09 -07:00
Raymond Feng
588b328e62
Fix the model prop lookup
2013-07-21 17:27:31 -07:00
Ritchie Martori
22db369fb8
Allow queries to filter fields
2013-07-17 09:05:37 -07:00
Ritchie Martori
d4ca20c01a
Add filter.fields support to dao and memory connector
2013-07-16 17:53:52 -07:00
Raymond Feng
be21815e7b
Rename jugglingdb to loopback-data
2013-07-16 11:59:53 -07:00
Ritchie Martori
a4247ad59f
Remove updateAttribute as remote method
2013-07-15 19:44:29 -07:00
Ritchie Martori
0aa0cabdd4
Fix inherit bug
2013-07-15 18:22:49 -07:00
Ritchie Martori
2de55df939
Fix extend by using util.inherits
2013-07-15 10:44:34 -07:00
Raymond Feng
12c28ce363
Fix typos
2013-07-15 10:38:54 -07:00
Raymond Feng
ef671825ff
Only flatten array/object for relational DBs
2013-07-12 19:10:42 -07:00
Raymond Feng
8e01e17bdb
Add support for nesting objects with an array
2013-07-12 18:59:43 -07:00
Raymond Feng
09ab8356b8
Fix the array data population
2013-07-12 12:36:14 -07:00
Raymond Feng
296b258f35
Add http mapping for create/updateAttributes methods
2013-07-11 16:49:18 -07:00
Raymond Feng
aa5bba3bac
Fix the ref to getSchemaType
2013-07-11 16:04:28 -07:00
Raymond Feng
194f68468a
Add support for nesting schema
2013-07-11 14:24:47 -07:00
Raymond Feng
049f4c0c38
Add Object type
2013-07-11 11:04:31 -07:00
Raymond Feng
12199ad779
Add support to use adapter constructor for initialization
2013-07-11 09:55:26 -07:00
Ritchie Martori
7684fe2946
Change default create method from save to create for remoting
2013-07-02 20:28:00 -07:00
Ritchie Martori
c8bfc5802a
Add event emitter methods to models.
2013-07-02 14:59:24 -07:00
Ritchie Martori
522291bf08
Add support for extending models
2013-07-01 16:49:43 -07:00
Ritchie Martori
dbd5efed50
Revert adapter serialization. Remove geo point distance indicator.
2013-07-01 13:16:51 -07:00
Ritchie Martori
e6a88ac254
Add properties to ModelClass during definition
2013-06-27 18:25:42 -07:00