Commit Graph

824 Commits

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