Commit Graph

324 Commits

Author SHA1 Message Date
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
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 adc9482df0 Enhance the test case with more assertions 2013-12-05 15:19:40 -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 995a2139c8 Rename association to relation 2013-11-15 20:29:20 -08:00
Raymond Feng 7aa2eefec4 Remove inheritence from DataSource to ModelBuilder 2013-11-08 17:13:00 -08:00
Raymond Feng 92d369e609 Add more assertions 2013-11-08 09:02:17 -08:00
Raymond Feng 0b899b0542 Allow settings.base to specify the base model 2013-11-07 17:11:17 -08:00
Raymond Feng 89a30e7edd Add a test case for relations during attach 2013-11-07 13:28:18 -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 f3011216b5 Support datasource/connector configuration using URL string 2013-10-25 16:18:02 -07:00
Raymond Feng bcf112f042 Add index to name prop 2013-10-17 14:24:47 -07:00
Raymond Feng 9ec9f654c7 Remove undefined values from the query object 2013-10-11 11:50:00 -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 7f170a0542 Add more tests and fix toJSON 2013-10-04 21:21:12 -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 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 1575c87caf Make sure schemaless property value is honored over __data 2013-09-18 16:34:52 -07:00
Raymond Feng c2eb1f55f0 Fix the property population for schemaless models 2013-08-28 21:49:05 -07:00
Raymond Feng 04ca1a6333 Clean up the test case based on PR reviews 2013-08-27 10:14:49 -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 463bf69ffc Fix the test description 2013-08-19 10:35:52 -07:00
Raymond Feng 9482d3c7de Fix the where option for delete 2013-08-18 10:58:53 -07:00
Raymond Feng d697fb5d4e Remove the semicov dependency as now we use blanket 2013-08-15 14:10:13 -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 57c181c8b9 Bring up json object introspection to build models 2013-07-26 13:06:43 -07:00
Raymond Feng 8c1a102179 Rename the test case 2013-07-24 23:04:13 -07:00
Raymond Feng 9b422752a6 Allows non-strict mode to accept unknown properties 2013-07-24 22:58:57 -07:00
Raymond Feng 6af4b1ba2f More renames: schema -> dataSource, adapter -> connector 2013-07-23 11:16:43 -07:00
Raymond Feng eeda934cc1 Rename the test case 2013-07-22 13:49:35 -07:00
Raymond Feng 2e81598006 ADL --> LDL 2013-07-22 13:48:28 -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
Raymond Feng 8e01e17bdb Add support for nesting objects with an array 2013-07-12 18:59:43 -07:00
Raymond Feng 4cd9ea49ec Add plain string array 2013-07-12 12:39:38 -07:00
Raymond Feng 09ab8356b8 Fix the array data population 2013-07-12 12:36:14 -07:00
Raymond Feng 194f68468a Add support for nesting schema 2013-07-11 14:24:47 -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 008b406dd7 model.find => model.findById, model.all => model.find 2013-06-24 12:42:58 -07:00
Raymond Feng 7b861c2aac Update buildModels and support associations via foreign keys 2013-05-31 10:25:11 -07:00
Raymond Feng 771bf70ec5 Add options including default 2013-05-28 15:40:16 -07:00
Raymond Feng 2a15926318 Add test cases for loading json doc 2013-05-28 15:26:12 -07:00
Raymond Feng 465a963d2d Adding more tests 2013-05-28 13:50:59 -07:00
Anatoliy Chakkaev f98f62388d Temp. disable test for validation 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 06641da2c6 Add context info to validation error 2013-05-13 22:04:29 -07:00
dgsan 1a91605340 Adds test for limit and skip + limit on `all()` queries as in docs.
(Currently not all adapters may pass.)
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 83027f9ead Accept related objects when creating instance #247 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev eecbd32d07 Allow null properties for headless models 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev a67f75f0be Check types of sync and async getters created by belongsTo, close #266 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev a73f53521e Fix m2m: only add fk when hasMany have no "through" 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev c9e97744dd Many-to-many relation
- hasMany {through: Class}
- hasAndBelongsToMany
- some specs in relations.test.js
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 9facf369b1 Some tests for scope 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 136ea91fbf Organize model.js 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev c4d4b68413 Datatypes casting 2013-05-13 22:04:28 -07:00
Raymond Feng 3eb6869174 Revert "Fix the test case so that it passes in the same filter"
This reverts commit 7538601b79.
2013-04-15 16:50:49 -07:00
Raymond Feng 7538601b79 Fix the test case so that it passes in the same filter 2013-04-10 21:09:09 -07:00
Anatoliy Chakkaev 43f395d653 Manually require init 2013-04-06 14:57:12 +04:00
Anatoliy Chakkaev 9fc4e5e887 Added datatypes tests 2013-04-06 14:34:16 +04:00
Anatoliy Chakkaev 67d186e26c Fix merged schema test 2013-04-05 02:14:16 +04:00
Anatoliy Chakkaev 4943feb230 Merge transactions 2013-04-05 02:13:14 +04:00
Anatoliy Chakkaev 43d1cbd39e Merge 2013-04-05 02:12:34 +04:00
Anatoliy Chakkaev 3a355851b6 ValidationError instead Error 2013-04-04 19:31:07 +04:00
Anatoliy Chakkaev 704bc965bd Find on hasMany scope method 2013-04-04 00:46:41 +04:00
Anatoliy Chakkaev be17763eca Return valid in case of sync validations 2013-04-01 20:13:55 +04:00
Anatoliy Chakkaev c5019ef354 Test update 2013-04-01 20:10:46 +04:00
Anatoliy Chakkaev b0a1ed3bed Fix validation issue 2013-04-01 20:08:22 +04:00
Anatoliy Chakkaev cf5ed5b877 Transactions 2013-04-01 17:49:12 +04:00
Anatoliy Chakkaev 349931780a Automigrate before relation tests 2013-03-31 15:24:03 +04:00
Anatoliy Chakkaev f36372ba80 Add more love to tests, pr #249 2013-03-31 14:17:25 +04:00
Anatoliy Chakkaev 76c7fbd6ec Merge branch 'http' of github.com:NiKnight/jugglingdb 2013-03-31 14:08:38 +04:00
Anatoliy Chakkaev 0776c51994 Batch create 2013-03-31 13:40:37 +04:00