Commit Graph

115 Commits

Author SHA1 Message Date
biniam 48af738ec4 fix: coerce primitive properties on update 2019-04-16 10:51:44 -04:00
Miroslav Bajtoš 7d69bdab70
Improve tests for empty vs. default values 2019-04-09 15:54:52 +02:00
Miroslav Bajtoš e45292de08
Do not apply default values on data from database
Before this change, when a property was configured with a default value
at LoopBack side and the database was returned a record with a missing
value for such property, then we would supply use the configured
default.

This behavior is problematic for reasons explained in #1692.

In this commit, we are fixing DAO operations like `find` and
`findOrCreate` so that they do NOT apply default property values on
data returned by the database (connector).

Please note that most of the other CRUD methods were already not
applying default values on database data as long as the connector
provided native implementation of the operation.
2019-04-04 09:47:31 +02:00
Miroslav Bajtoš 9e0f624ad5
manually fix remaining problems 2018-12-07 16:46:15 +01:00
Miroslav Bajtoš 422ec9ad4f
autofix eslint errors 2018-12-07 16:46:15 +01:00
Tom Kirkpatrick 251798c711 fix: ignore extra properties when strict=filter (#1423)
Fix for #1422
2018-08-29 22:57:37 -04:00
Miroslav Bajtoš 7d50f6130b
Upgrade eslint-config-loopback + fix formatting
The new version of our config enabled function-paren-newline rule,
this commit fixes the codebase to use more consistent handling
of newlines when calling functions.
2018-07-16 08:46:25 +02:00
shenghu bc16692d9b assertation of undefined could be null 2018-07-09 11:53:27 -04:00
Miroslav Bajtoš d2ee73b9d3
Update eslint + config to latest 2018-06-12 09:13:32 +02:00
loay 01b4c4a3a7 Catch err using Callback 2017-08-16 17:00:41 -04:00
ssh24 80f015c2d2 Honor backwards compatability with validate update 2017-08-03 11:50:44 -04:00
ssh24 b1a0cb8c3b Validate updateAll 2017-08-02 13:24:21 -04:00
loay b1b2d5df0c Catch errors using cb 2017-07-24 14:08:58 -04:00
Janny 6a1b55568c Skip imcompatible tests (#1420)
* Skip imcompatible tests
2017-07-18 15:20:21 -04:00
Janny b9129e6973 Run juggler tests for Cloudant (#1414) 2017-07-11 14:56:39 -04:00
Raymond Feng 5a0b0270f3 Return promise for batch create 2017-05-19 16:16:52 -07:00
Loay 87dd44dd59 Fix assertion errors 2017-05-04 10:38:06 -04:00
Diana Lau a488a71dbd replace exception thrown for invalid dates 2017-04-21 15:57:11 -04:00
Loay 3c19beacbb Add test case using updateAttributes 2017-04-18 13:50:57 -04:00
Loay f1d10b47ce Fix forceId bug for updateOrCreate 2017-04-18 13:14:35 -04:00
Loay 9dc5430652 Unskip test case 2017-04-12 12:54:30 -04:00
Tetsuo Seto ead1fb2965 Add test support for Cassandra connector 2017-04-07 11:10:47 -07:00
Matteo Padovano 957058e2d4 remove equality value for user defined id (#1293)
Some connector, like arangodb, not support id as Number.
When `forceId` is set to true and id is set `Model.isValid`
report error and the field id is not coerced.
2017-04-04 12:45:23 -04:00
Kevin Delisle a6c5802940 dao: catch sync errors on setAttributes
Wrap inst.setAttributes in try-catch to prevent synchronous errors
from crashing the application.
2017-03-16 17:26:53 -04:00
Loay 4bd03a25f2 Ensure replaceById returns 404 when id not found 2017-02-01 11:57:54 -05:00
Loay 44a5a7ad81 Fix forceId validation error 2017-01-26 16:52:19 -05:00
Miroslav Bajtoš 454bf93aaf Upgrade eslint-config to 7.x
Also upgrade eslint itself to 3.x.
2017-01-06 13:33:54 +01:00
Siddhi Pai 3baa61590e Fix block padding
* Remove test/.eslintrc
* run eslint . --fix
2016-12-13 16:05:50 -08:00
Miroslav Bajtoš 0f7a567f18 Upgrade eslint & config to latest
- eslint ^3.11.1
 - eslint-config-loopback: ^6.0.0
 - fix linter errors (mostly no-undef)
2016-12-05 15:14:09 +01:00
Amir Jafarian e391fd0f3e Tests cleanup
* Tests cleanup for `manipulation.test` and `scope.test`
2016-11-29 10:45:03 -05:00
Amir Jafarian fab269687b Correct tests for DAO.Create
* Create does not return data back
2016-11-28 17:18:10 -05:00
Simon Ho 06d4b90071 Add code review fixups 2016-09-22 16:15:32 -07:00
Tim De Pauw 5636c15903 More descriptive name for model with shortid 2016-09-22 16:07:34 -07:00
Tim De Pauw 419a464d06 Polish PR 2016-09-22 16:07:34 -07:00
Tim De Pauw be1d71f626 Support {defaultFn: 'shortid'} 2016-09-22 16:07:34 -07:00
David Cheung 805db78e19 Strict mode now always return validationError
- Deprecation of strict:validate and strict:throw
- When strict mode is enabled, it will now always
return validation error (previous strict:validate)
2016-09-19 10:27:24 -04:00
Loay 32a6b68f1d Skip test temporarily 2016-09-09 14:48:41 -04:00
Simon Ho 11ce971ad0 Fix BSON Object ID errors for CI 2016-09-08 13:16:55 -07:00
Amir Jafarian 581b8c61bf Fix failures of upsertWithWhere
Forwardport of #1052
2016-09-02 15:46:36 -04:00
Amir Jafarian aec678d252 Fix manually 2016-08-22 19:20:12 -04:00
Amir Jafarian aa6d28268b Auto-update by eslint --fix 2016-08-22 15:12:25 -04:00
Sonali Samantaray 37541dd178 upsertWithWhere feature support in juggler DAO 2016-08-16 18:06:01 +05:30
jannyHou 8935b978f3 forceId=true with auto-increment db 2016-08-08 16:26:26 -04:00
Richard Pringle 0b62dd94ea Disallow bulk updateOrCreate. 2016-08-05 11:54:06 +02:00
Supasate Choochaisri f967773b2a Fix test case typo
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-07-24 19:38:37 +07:00
Amir Jafarian 9f0c10fdff Add test for updateOrCreate
* Add test for updateOrCreate when id is not autogenerated Id
2016-07-07 12:55:22 -04:00
Amir Jafarian 7a8803cb38 Give warning if PK is changed in hooks
* Give warning if PK is changed in `before save` and `loaded`
 operation hooks for replaceById
2016-06-08 11:56:19 -04:00
Amir Jafarian cae44f0458 Fix error message
*Fix error message when PK is changed in `replaceById`
2016-06-01 16:16:35 -04:00
Amir Jafarian d9a3f6226a Fix incompatibility between different connectors
* Fix incompatibility for replace methods between different connectors.
2016-05-27 13:45:24 -04:00
Miroslav Bajtoš 8ad53a4c0e DAO.create: don't return the instance
Simplify DataAccessObject.create() and stop returning the
instance/array of instances. Users should always use callback (or
returned promise) to get the instance(s) created.
2016-04-29 14:16:06 +02:00