Commit Graph

607 Commits

Author SHA1 Message Date
Raymond Feng b22dae3c7a Merge pull request #281 from clarkorz/fix/hasManyThrough-custom-relation-name
Allows the belongsTo relations in through model to have custom name
2014-09-03 08:14:59 -07:00
Clark Wang 1393bd0759 Refector tests and codes
1. remove error
2. prune tests

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-03 21:51:21 +08:00
Clark Wang b6f2026493 Refactor tests and codes
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-03 19:58:39 +08:00
Raymond Feng cf3128467c Merge pull request #275 from clarkorz/feature/add-with-through-data
Allow to add connection with through data for HasManyThrough relation
2014-09-02 22:44:01 -07:00
Clark Wang 26547f8461 Refactor codes into same if condition
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-03 12:31:09 +08:00
Clark Wang 902885c3f8 Remove only
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-03 11:30:32 +08:00
Clark Wang 69b01b23f9 Add tests for hasMany through between same model
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-03 11:29:32 +08:00
Clark Wang cb2aeb96fb Fix hasMany through can't custom relation name
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-03 11:04:58 +08:00
Raymond Feng 6020436063 Added a test case for neq 2014-09-02 08:36:37 -07:00
Clark Wang 4b70f2498f Fix options for hasManyThrough doesn't apply
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-01 23:59:52 +08:00
Raymond Feng f9a26bcb28 Merge pull request #270 from fabien/feature/dynamic-scope-modelTo
Enable dynamic modelTo for scopes
2014-08-31 08:39:14 -07:00
Raymond Feng 97827db59d Merge pull request #268 from fabien/feature/transient-model
Transient connector implementation
2014-08-31 08:37:26 -07:00
Raymond Feng 6527bd0605 Merge pull request #259 from fabien/fix/refactor-validations
Validations configuration as object
2014-08-31 08:37:03 -07:00
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
Fabien Franzen 3f517a4c0a Reset json when building model definition 2014-08-31 12:17:53 +02:00
Fabien Franzen e874810499 Add hint, minor cleanup 2014-08-30 21:08:23 +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 fde5b426e4 Make sure error events are emitted by data source 2014-08-27 09:14:17 -07: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 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
Raymond Feng 6bc2a53afb Tweak the model names used by tests to avoid mssql conflicts 2014-08-25 22:17:51 -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
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 a1c1a9c658 Fix the embedsOne test cases 2014-08-20 11:42:14 -07:00
Raymond Feng 5088c4dd74 Fix test cases 2014-08-20 08:58:08 -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
Raymond Feng 0290109cdb Fix test cases 2014-08-19 15:23:37 -07: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 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
Fabien Franzen ad780604e1 Properly handle LDL for polymorphic relations 2014-08-16 11:03:16 +02:00
Raymond Feng f37941dfd6 Fix the test cases to avoid hard-coded ids 2014-08-15 13:48:38 -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 c599de42cd Remove redundant test 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 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 94310549cf Implement embedded.destroy() integration 2014-08-15 18:41:06 +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 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
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
Raymond Feng 950be998bc Fix the test case so that it works with other DBs 2014-08-08 09:39:36 -07:00
Raymond Feng caff62d8b3 Merge branch 'fabien-feature/plugins' 2014-08-08 09:29:17 -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
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 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 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
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
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 296bb0d73e Minor touchups 2014-07-29 14:05:18 +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
Laurent Chenay b336166acc Add test to protect the use of include in related method 2014-07-29 11:05:57 +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
Fabien Franzen 7ddfbb6409 polymorphics can now be declared using object 2014-07-28 10:44:26 +02:00
Fabien Franzen 43e11af942 Test build of embedsMany 2014-07-27 17:16:25 +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
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 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š 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
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
Raymond Feng 8f46626c0b Expose base model class as `base` property 2014-07-21 10:21:30 -07:00
Raymond Feng fc710ca55a Merge branch 'master' into 2.0 2014-07-15 17:09:20 -07:00
Raymond Feng 82c6c8e851 Make sure related properties are defined for RDBMS 2014-07-15 16:10:37 -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
Fabien Franzen 03617b58df Sign-off
Signed-off-by: Fabien Franzen <info@atelierfabien.be>
2014-07-12 00:24:07 +02:00
Fabien Franzen 48c4f25b09 Renamed mapping to properties 2014-07-12 00:02:16 +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
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 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
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 44de2da21f Merge branch 'master' into 2.0 2014-06-20 23:02:37 -07:00
Raymond Feng a2a91499dd Fix the test case 2014-06-20 21:07:26 -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 b07c36eab7 Use async for flow control 2014-06-20 12:05:42 -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 7c71e1e53b Merge pull request #141 from strongloop/feature/fix-perf
Feature/fix perf
2014-06-18 22:40:00 -07:00
Raymond Feng 888d15ce1c Optimize model instantiation and conversion 2014-06-18 22:13:52 -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
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 2db43c58e5 Add support for hasOne 2014-06-16 01:17:37 -07:00
Raymond Feng 1406c22a64 Refactor relation into classes 2014-06-15 15:53:58 -07:00
Raymond Feng bb57fcbe11 Fix the comparison for null/boolean values 2014-06-10 16:11:50 -07:00
Raymond Feng b5816506e0 Add boolean tests 2014-06-06 09:28:08 -07:00
Raymond Feng 171642ff48 Make sure the records are sorted by seq 2014-06-06 09:09:56 -07:00
Raymond Feng 0191e3c2db Add more tests 2014-06-06 08:48:05 -07:00
Raymond Feng 5f3c856d2e Fix the logical operator check 2014-06-04 14:23:53 -07:00
Raymond Feng 42c1ad3dca Normalize/validate the query filter object 2014-06-02 15:57:44 -07: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
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
Ritchie Martori 69b0355fa7 Merge pull request #115 from strongloop/refactor/remove-remoting
Remove remoting metadata
2014-05-20 13:59:33 -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 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
Raymond Feng 3f410cae21 Add test cases for updateOrCreate/save and fix related issues 2014-05-09 15:27:45 -07:00
Ritchie Martori aea5836569 Add hidden property support 2014-04-11 11:39:57 -07:00
Miroslav Bajtoš 4da4c65faa Re-enable skipped test.
test/relations: hasMany should fetch all scoped instances

The test is passing with the current implementation.
2014-04-02 19:35:14 +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 b42f7d2498 Remove the disconnect to avoid race condition 2014-03-27 13:56:24 -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 1dc0c34252 Fix the connector resolver to make sure known connectors are used 2014-03-17 08:32:37 -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 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 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
Raymond Feng 7e45a1fda1 Fix the include with array value 2014-02-14 10:40:45 -08:00
Raymond Feng 0d3ce00f35 Simplify the test case 2014-02-12 22:49:54 -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 22eef6a33d Add a test case 2014-02-10 22:46:25 -08:00
arlaneenalra 99dff35de2 Add unit test for datatype handling in updateAttributes. 2014-02-07 06:50:35 -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 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 6e1900ca01 Add tests 2014-01-27 16:04:37 -08:00
Raymond Feng 2b8c1ebaee Reformat the code 2014-01-24 09:09:53 -08:00
Raymond Feng c374cc89cd Use the primary key type for the generated foreign key 2014-01-21 09:47:32 -08: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 c9e133d7bc Add a EOL 2013-12-18 17:14:54 -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 aeecfa5551 Split the tests 2013-12-16 08:36:15 -08:00
Raymond Feng 1b9edbcfcb Fix a regression in mongodb connector 2013-12-15 22:51:47 -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