Commit Graph

96 Commits

Author SHA1 Message Date
Raymond Feng c609b6d7ce Allow leading slash for `path` in model settings 2015-04-24 08:23:13 -07:00
Miroslav Bajtoš cd7bc46efb Deprecate property names containing a dot 2015-04-02 09:49:04 +02:00
Miroslav Bajtoš 9fd4c00225 Add model setting "persistUndefinedAsNull"
When the setting "persistUndefinedAsNull" is true,
the model will use `null` instead of `undefined` in
all property values.

 - Known optional model properties are set to `null` when no value
   was provided.

 - When setting model properties, `undefined` is always converted
   to `null`. This applies to both known (model-defined) properties
   and additional (custom, dynamic) properties.

 - The instance method `toObject()` converts `undefined` to `null` too.
   Because `toJSON()` calls `toObject()` under the hood, the change
   applies to `toJSON()` too.
2015-03-27 18:25:26 +01:00
Raymond Feng cd1d815936 Use the correct way to iterate over an array
See https://github.com/strongloop/loopback-datasource-juggler/issues/512
2015-03-18 08:21:32 -07:00
Raymond Feng 33d3239b44 Allow submodel to hide base properties 2015-03-03 10:27:22 -08:00
Miroslav Bajtoš 37d7721e0e Deprecate DAO events
List of deprecated events:

 - changed
 - deleted
 - deletedAll
2015-02-27 17:03:39 +01:00
Raymond Feng a8f3d21b65 Merge pull request #436 from strongloop/feature/fix-issue-293
Make sure base properties/settings are merged into the submodel
2015-02-11 16:13:00 -08:00
Raymond Feng ecf84bf802 Enhance the coercion for boolean/date types
See https://github.com/strongloop/loopback-connector-mongodb/issues/90
2015-02-08 10:54:42 -08:00
Raymond Feng cd2bd34619 Make sure base properties/settings are merged into the submodel
See https://github.com/strongloop/loopback-datasource-juggler/issues/293
2015-02-07 11:15:28 -08:00
Raymond Feng bba1ce0768 Merge pull request #405 from clarkorz/fix/id-for-compositeIds
fix id property for composite ids
2015-02-02 08:59:40 -08:00
Miroslav Bajtoš b3d07ebbe8 ModelBaseClass: implement async observe/notify
Implement infrastructure for intent-based hooks.
2015-01-29 08:43:50 +01:00
Clark Wang 2e9e2dd192 fix id property for composite ids
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-01-22 10:39:47 +08:00
Berkeley Martinez 3fac41985b Fix virtual id get function. 2015-01-12 08:43:55 -08:00
Miroslav Bajtoš 14d178bf69 Don't inherit settings.base when extending a model
Fix the bug in `ModelClass.extend` where the `base` option used
in the new class was inherited from ModelClass. As a result
the extended model was incorrectly based on ModelClass's parent.

Modify `modelBuilder.define` to normalize the property name storing
the name of the base model to `settings.base`.
2014-10-10 18:35:18 +02:00
Raymond Feng fe74c8019c Tidy up model building from data sources
See https://github.com/strongloop/loopback/issues/560
2014-09-12 14:25:35 -07:00
Fabien Franzen 39a728be84 Add ability to apply a plugin multiple times from LDL 2014-08-17 12:29:04 +02:00
Rand McKinney 4cb22793e2 Fix links to confluence docs 2014-08-11 11:42:21 -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 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
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
Fabien Franzen ef65ffee48 Changed normalization api - enabled hasOne remoting 2014-08-01 11:24:41 +02:00
Fabien Franzen 71bf0f8240 Customize/Normalize class-level remoting http path 2014-08-01 09:38:25 +02:00
Raymond Feng 8bc11ca51e Increase the max number of model listeners
See https://github.com/strongloop/loopback/issues/404
2014-07-28 13:02:00 -07: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 a37129bdff Allows default model class to be configured 2014-07-08 14:04:20 -07:00
Raymond Feng 44de2da21f Merge branch 'master' into 2.0 2014-06-20 23:02:37 -07:00
Raymond Feng 888d15ce1c Optimize model instantiation and conversion 2014-06-18 22:13:52 -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
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
crandmck 9c2098cd35 Updates to JSDoc comments for API doc 2014-03-12 16:28:46 -07:00
Aurelien Chivot dfe1ea1655 Fix, model builder setter will not try to cast value if already the proper type 2014-02-26 21:10:15 +01:00
Raymond Feng 85232f31b3 Clean up the options for model constructor 2014-02-10 22:38:59 -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 2b8c1ebaee Reformat the code 2014-01-24 09:09:53 -08:00
Miroslav Bajtoš dbb7c6d9ae Fill ModelClass.http.path
Set the HTTP route to `'/' + pluralModelName` so that we don't have
to duplicate this bit of logic in strong-remoting and other places.
2014-01-21 16:31:11 +01: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
Ritchie Martori 749a494e53 Always call inherits to ensure prototypes are setup 2013-12-13 11:27:29 -08:00
Raymond Feng 29405976fb Merge settings for base and sub models 2013-12-06 15:52:39 -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 275bb6ffac Stop overwriting the static methods 2013-11-11 22:05:50 -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 34107a6a26 Redefine the existing class if it's resolved 2013-11-06 14:00:22 -08:00
Raymond Feng 4fbec288c4 Enable deferred type/relation resolutions 2013-11-04 22:53:02 -08:00