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
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
Amir Jafarian
11ef948854
Test coverages for hashed password
...
* Test coverages for hashed password for replaceAttributes
* Test coverages for hashed password for updateAttribute
2016-04-14 18:27:19 -04:00
Amir Jafarian
4bb284bb60
Define `patch` aliases
...
*Define `patchOrCreate` as an alias for `updateOrCreate`
*Define `PatchAttributes` as an alias for `updateAttributes`
2016-04-12 13:40:01 -04:00
Miroslav Bajtoš
27c6279d6c
fix remaining eslint issues
2016-04-05 15:25:34 +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
Amir Jafarian
8b8d474b92
Add automigrate to setup tables for replace test cases
2016-03-29 12:21:10 -04:00
Amir Jafarian
024bff6a91
Fix tests for mysql
2016-03-08 20:39:25 -05:00
Amir Jafarian
2281e95940
Implementtaion of replace
...
This includes:
*implementation of replaceAttributes
*implementtaion of replaceOrCreate
2016-02-03 16:06:35 -05:00
Simon Ho
9cfda16194
Fix failing test for MongoDB connector
2015-12-09 12:58:21 -08:00
Wilson Júnior
c26b857a87
UpdateAttributes: Raises an error if database fails
...
Signed-off-by: Wilson Júnior <wilsonpjunior@gmail.com>
2015-11-17 17:10:11 -02:00
Bram Borggreve
fb11c78be0
Add support for using UUID V4 as defaultFn
2015-09-02 16:39:00 +02:00
Raymond Feng
682f6340d3
Optimze automigrate() to cut the test time signicantly
2015-08-27 15:59:58 -07:00
Fabien Franzen
2120e53f7f
Indicate result of destroyById/protototype.destroy
...
Return `info.count` to the callback to indicate whether the model
instance was deleted or not. When Model's `settings.strictDelete`
is true, return 404 error when the model instance was not found.
2015-08-10 17:38:46 +02:00
Fabien Franzen
c7caa0a7c1
Take strict: validate and throw settings into account
2015-07-21 13:33:42 +02:00
Fabien Franzen
8b06a9d39d
Filter attributes when strict: true
2015-07-20 11:59:07 +02:00
Raymond Feng
d192b2ea05
Fix the test cases so that they be run with the mssql connector
...
For SQL server, if the PK is an identity, the id cannot be set for
insert.
2015-03-27 14:18:17 -07:00
Simon Ho
311ab293d2
Clean up delete and update tests
2015-03-24 21:30:40 -07:00
Simon Ho
f7540edf8a
Clean up wording in update/delete tests
2015-03-24 12:15:35 -07:00
Simon Ho
8467243e63
Fix wording in update test
2015-03-24 11:47:13 -07:00
Simon Ho
3f97586455
Clean up update/delete manipulation tests
2015-03-23 14:41:38 -07:00
Miroslav Bajtoš
35b549543d
test: fix test failure in MySQL connector
...
Fix a test using a string Person.id value to use a numeric value
instead, in order to support connectors that use numeric ids by default.
2015-03-23 09:18:46 +01:00
Miroslav Bajtoš
1fbaf4e382
Improve test failure messages
...
Replace
foo.count.should.equal(X)
Uncaught TypeError: Cannot read property 'should' of undefined
with
foo.should.have.property('count', X)`
Uncaught AssertionError: expected 0 to have property count
2015-03-23 08:44:53 +01:00
Miroslav Bajtoš
f7dc6fab90
Fix regression in prototype.save
...
ffcaa4e7
added a "data" argument to the callback function, which
shadowed the original data with the data returned by a connector.
Not all connectors are returning a data object though, in which case
the model instance ("this" object) is updated with wrong values.
This commit fixes the problem by renaming the second callback argument
to "unusedData".
2015-03-23 08:34:21 +01:00
Raymond Feng
6a40a8a5e5
Enhance id comparision for updateAttributes
...
string/number and MongoDB ObjectID equality are now allowed.
2015-03-20 11:06:24 -07:00
Simon Ho
04f35b31b4
Memory connector returns updated records count
...
The memory connector now includes the number of updated items in its callback
when updating records.
2015-03-19 15:40:14 -07:00
Miroslav Bajtoš
d731252941
deleteAll returns number of deleted records
...
The number is returned as `data.ctx` to `cb(null, data)`.
2015-03-19 17:54:22 +01:00
Miroslav Bajtoš
ae3dc3cec2
Merge pull request #510 from strongloop/fix/duplicate-create
...
Reject CREATE with a duplicate id
2015-03-19 17:37:01 +01:00
Miroslav Bajtoš
6f11c2d717
DAO: Fix updateOrCreate to set persisted:true
...
Before this commit, the following code would not work:
Change.updateOrCreate({...}, function(err, ch) {
// somewhere later, modify "ch" and save the changes
ch.save(cb);
});
2015-03-16 18:26:42 +01:00
Miroslav Bajtoš
902772f1af
Reject CREATE with a duplicate id
...
Modify the memory connector to reject requests to create a record
with a duplicate id.
Add a unit-test to verify this behaviour across all connectors.
2015-03-16 18:26:42 +01:00