Commit Graph

23 Commits

Author SHA1 Message Date
Miroslav Bajtoš c7f34c3452 eslint config 2.0 + remove extra empty lines
Upgrade eslint-config-loopback to ^2.0.0.

Remove extra empty lines to make `npm run lint` pass again.
2016-04-19 16:11:43 +02:00
Miroslav Bajtoš 39e04a1756 eslint --fix 2016-04-05 15:25:34 +02:00
Ryan Graham c467b43c38 Insert copyright headers 2016-04-04 18:14:03 -07:00
Raymond Feng 682f6340d3 Optimze automigrate() to cut the test time signicantly 2015-08-27 15:59:58 -07:00
Miroslav Bajtoš 1fd6eff10f Intent-based hooks for persistence
This patch introduces a new API for "intent-based" hooks. These hooks
are not tied to a particular method (e.g. "find" or "update"). Instead,
they are triggered from all methods that execute a particular "intent".

The consumer API is very simple, there is a new method
Model.observe(name, observer), where the observer is function
observer(context, callback).

Observers are inherited by child models and it is possible to register
multiple observers for the same hook.

List of hooks:

 - query
 - before save
 - after save
 - after delete
2015-01-29 08:43:52 +01:00
Raymond Feng 9325ce316b Allow before hooks to pass arguments to next() 2014-07-15 12:51:33 -07:00
Ritchie Martori e909749455 Add tests for change / delete events 2014-01-29 11:03:04 -08:00
Raymond Feng 2b8c1ebaee Reformat the code 2014-01-24 09:09:53 -08:00
Raymond Feng 6af4b1ba2f More renames: schema -> dataSource, adapter -> connector 2013-07-23 11:16:43 -07:00
Anatoliy Chakkaev 83027f9ead Accept related objects when creating instance #247 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev c4d4b68413 Datatypes casting 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 43f395d653 Manually require init 2013-04-06 14:57:12 +04:00
Anatoliy Chakkaev f36372ba80 Add more love to tests, pr #249 2013-03-31 14:17:25 +04:00
Scott Nonnenberg 5655e8f4d2 tests only: no afterCreate/afterUpdate on errors
Added tests to ensure that the afterCreate/afterUpdate handlers are not run if the adapter returns an error.
2013-03-30 17:20:32 -07:00
Scott Nonnenberg 2ba862f5af afterDestroy not called on adapter error
Similar to afterCreate and afterUpdate, we don't want to run the afterXXXX handlers if the delete failed according to the adapter.
2013-03-30 17:18:47 -07:00
Anatoliy Chakkaev 839791de2f Upd tests
- skipping
- hook up redis-hq
- some stuff should be moved to advanced-querying tests
2013-03-29 11:43:04 +04:00
Anatoliy Chakkaev 7707b236ff Test hooks and object lifecycle as per #242 2013-03-28 15:27:50 +04:00
Anatoliy Chakkaev 2d6cc9aaee Mongodb tolerance 2013-03-27 21:53:07 +04:00
Anatoliy Chakkaev b04a250b63 Update attribute additional test 2013-03-27 18:53:46 +04:00
Anatoliy Chakkaev ffdfac30e1 Migration-friendly tests 2013-03-27 04:50:34 +04:00
Anatoliy Chakkaev 0d5f4a9aad Added test case for #238: password hashing before save 2013-03-27 00:49:02 +04:00
Anatoliy Chakkaev d5d07d8806 Make tests importable 2013-03-26 04:41:00 +04:00
Anatoliy Chakkaev 5ea5da0153 Rewrite hooks API
This commit breaks compatibility, but adds consistent API and allow modify data of update
2013-03-25 01:25:10 +04:00