Commit Graph

446 Commits

Author SHA1 Message Date
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
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 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