Raymond Feng
52d2c8425f
Make all methods proxied for DAO
2013-12-04 13:44:25 -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
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