Eric Barault
64f64caaff
handle deep geo-near queries ( #1314 )
...
* handle deep geo-near queries (#1216 )
a dedicated mongKey is added in geo.nearFilter for mongoDB
fixes geo min distance tests as filter now expects an array
* Fix for string geoPoints
* Add geo point handle for ibmdb connectors
* Handle geo-point type for cassandra connector
2017-04-13 17:05:05 -04:00
Loay
9dc5430652
Unskip test case
2017-04-12 12:54:30 -04:00
Tetsuo Seto
c1598584d8
Make tests work for other connectors as well as C*
...
Adjust getSchema calls
Compare ids as strings
Run tests when explicitly set to true
2017-04-12 09:11:42 -07:00
Tetsuo Seto
696e4cfa80
Remove debugger statement
2017-04-07 15:05:15 -07:00
Tetsuo Seto
0f9100f185
Fixup test support for Cassandra connector
2017-04-07 14:11:33 -07:00
Tetsuo Seto
ead1fb2965
Add test support for Cassandra connector
2017-04-07 11:10:47 -07:00
Kevin Delisle
00fe8fd59e
Merge pull request #1313 from strongloop/revert-1216-fix/geo.nearFilter-deep
...
Revert ""Near" fix for where clauses"
2017-04-06 18:29:48 -04:00
Sakib Hasan
befea83a76
Revert "handle deep geo-near queries ( #1216 )"
...
This reverts commit 6f88cf1930
.
2017-04-06 17:45:04 -04:00
Joshua Chaitin-Pollak
bb3812fbfb
Allow `after save` hook to see count of records changed ( #1231 )
...
* `after save` hook allows count of records changed
* Fix PR linter
2017-04-06 12:02:34 -04:00
Corentin H
6f88cf1930
handle deep geo-near queries ( #1216 )
...
a dedicated mongKey is added in geo.nearFilter for mongoDB
fixes geo min distance tests as filter now expects an array
2017-04-06 08:25:04 -04:00
Jonathan Sheely
21b08af7a3
Added notify flag for create and upsert ( #1277 )
...
* Added notify flag for create and upsert
* Code styling
* More code styling
* Added unit test for notify
* Fix PR linter
2017-04-05 13:23:26 -04:00
Waldemar Zahn
ef143dc5eb
Custom Table Names on rels ( #1303 )
...
hasAndBelongsToMany relation
2017-04-05 12:42:21 -04:00
Thaer Abbas
57ead01624
#1261 Property name "constructor" is not allowed in 'Model' data ( #1284 )
...
* check if data has a constructor prop
* test data with no constructor
* test non function constructor
* test non function ctor message
* cleanup
2017-04-04 13:35:24 -04:00
Raymond Feng
1f995ec674
Use dataSource.connect to avoid duplicate connects
2017-04-04 10:19:58 -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
Raymond Feng
0a408476ec
Fix in-mem connector file operation racing condition
2017-04-04 08:25:15 -07:00
Vincent Wen
8c93710963
make geo nearFilter support minDistance ( #987 )
2017-03-26 10:04:16 -04:00
Mikhail
68b93e1074
Disallow regexp string in arrays for coerce ( #1279 )
...
Disallow regexp arrays for coerce
2017-03-22 20:29:01 -04:00
Clark Wang
c99441247c
Fix - `_targetClass` on scope function ( #1280 )
...
Fix `_targetClass` on scope function when using hasManyThrough
relation with customized relation names and foreignKey/keyThrough.
This bug is cause by `_targetClass` uses the camel-case of
`relationName`(e.g.: if `relationName` is `bbb`, `targetClass`
would be `Bbb`), which is not exists.
This will also suppress "not exposed" warnings when generating
angular sdk, and generate end-points for this scope.
2017-03-22 17:06:36 -04:00
Nick Oikonomou
b3a7bc521d
Fixes #1275 . `Include` filter transforms fields property into array. ( #1276 )
...
* Fixes#1275 Transform *fields* property into array
`Include` filter takes into consideration string property
'fields' and transforms it into an array containing this string.
* Added error handling for `include` filter.
* ExecTasksWithInterLeave now contains a try-catch block
in order to catch any unexpected errors.
* LinkManyToMany now checks if *modelToIdName* exists on
*target* before continuing.
* Added unit test for *include* with string fields
2017-03-22 10:03:36 -04:00
Dimitris
77c4cd7b01
Included models from include operations do not change defined `strict` model option ( #1259 )
...
* Fixes #1252
* Allowed setting of dynamic relation property
* Fixed tests to also consider other connectors
2017-03-20 19:48:57 -04:00
Dimitris
2bfc769c4d
Using a filter with exclusion of a non existent property, removes an existing one ( #1257 )
...
* #fixes 1256
* Added missing check for returned error
* Fixed test to check proper fields in each doc
2017-03-20 19:18:48 -04:00
Dimitris
6f8ecfdf5c
Fixes #1230 coerceArray converts empty Objects ( #1269 )
2017-03-20 10:05:11 -04:00
Matteo Padovano
1f52d23d67
override collection name for arangodb ( #1243 )
...
Add collection name settings for arangodb database.
Required to pass common tests included in community connector
2017-03-20 09:01:16 -04:00
Rémi Bèges
55128f0c9b
Add test coverage for `validatesInclusionOf` ( #1249 )
...
* Fix indentation
* Improve tests formatting
* Use instanceof and should.match
2017-03-18 06:50:10 -04:00
Kevin Delisle
248aaf0541
dao: catch errors on Model creation in find
2017-03-16 17:26:53 -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
557a2e48d2
Fix Order query test case
2017-03-15 14:45:36 -04:00
Rémi Bèges
11c2a19ad2
Add tests for validatesExclusionOf ( #1248 )
2017-03-08 10:24:18 -05:00
Rémi Bèges
9afaa9a66e
Fix id update error message formatting
...
Error is raised when trying to update an id property while forceId
is set to true
2017-02-15 18:26:32 +01:00
jannyHou
8b1100e3ed
Add test case for all connectors
2017-02-14 14:01:44 -05:00
Loay
9541bb5f15
Add proper statusCode for duplicate
2017-02-08 23:52:14 -05:00
Miroslav Bajtoš
e8a977f55b
Fix datasource to report connector-loading errors
...
Before this change, when resolving full connector path, all errors were
ignored. As a result, when the connector was installed but not
correctly built (e.g. loopback-connector-db2 which uses a native addon),
a very confusing message was reported by LoopBack.
In this commit, I am fixing the code handling `require()` errors
to ignore only MODULE_NOT_FOUND errors that contain the name
of the required module.
2017-02-03 20:29:11 +01:00
Loay
4bd03a25f2
Ensure replaceById returns 404 when id not found
2017-02-01 11:57:54 -05:00
Miroslav Bajtoš
d809260799
Upgrade eslint-config, fix new violations
2017-02-01 12:45:56 +01:00
Matteo Padovano
733ad1a024
Refactor logic of options.allowExtendedOperators
...
Implement logic to allowExtendedOperators options
per request, per Model and Datasource.
2017-01-30 00:05:56 +01:00
Loay
44a5a7ad81
Fix forceId validation error
2017-01-26 16:52:19 -05:00
Miroslav Bajtoš
b5d03b845f
Add two basic tests for "inq" operator
2017-01-19 13:33:39 +01:00
Simon Ho
9a0d34a7a3
Add missing return for KVAO delete all
2017-01-13 00:19:10 -08:00
Simon Ho
188fb10c96
Add missing return in KVAO keys test suite
2017-01-11 19:35:37 -08:00
Simon Ho
0b93c5c6dd
Detect deleteAll support in KVAO tests
...
Clear CacheItem data between tests if connector supports `deleteAll`.
Tests fail with 501 if this check is not used.
2017-01-11 16:30:33 -08:00
Heath Morrison
2377792c22
Coerce array-like objects into arrays
...
The query-string parser used by express
https://github.com/ljharb/qs#parsing-arrays
limits the size of arrays that are created from query strings to 20
items. Arrays larger than that are converted to objects using numeric
indices.
This commit fixes the coercion algorithm used by queries to
treat number-indexed objects as arrays. We still maintain a strict
understanding of an "array-like object" to limit the opportunity for
subtle bugs. In particular, the presence of non-index keys is an
indication that the object was not intended to be interpreted as
an array.
2017-01-10 14:46:41 +01:00
Simon Ho
2320df1227
Refactor flush to deleteAll
...
- Rename `flush` to `deleteAll`
- Add `delete`
- Detect `delete/deleteAll` before running downstream test suites
- Fall back to unoptimized `deleteAll` when connector does not support
`deleteAll` but supports `delete`
- Return 501 for connectors not supporting `delete` or `deleteAll`
2017-01-09 14:53:34 -08: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
Brian Schemp
cd94be2fb8
Throw error when model relation name is trigger
...
Defining a model relation with the name "trigger" causes the model not
able to insert records. No error is thrown when a model relation with
the name "trigger" is defined. Adding a check for the model relation
name "trigger" will now throw an error.
2017-01-02 17:09:14 +01:00
Simon Ho
f38709b7cb
Add flush operation to KVAO
...
Used to delete all keys (and values) associated to the current model.
2016-12-30 18:06:36 -08:00
Simon Ho
d095cc1161
Merge pull request #1194 from strongloop/1237/fix-block-padding
...
Fix block padding
2016-12-21 14:17:42 -08:00
Miroslav Bajtoš
2ca081216b
Fix eslint errors reported by the latest eslint
2016-12-20 17:37:54 +01:00
Siddhi Pai
3baa61590e
Fix block padding
...
* Remove test/.eslintrc
* run eslint . --fix
2016-12-13 16:05:50 -08:00
Simon Ho
c5e905f5c4
Fix linter errors for CI
2016-12-09 18:13:58 -08:00
Miroslav Bajtoš
779cf6a370
Honour allowExtendedOperators in "DAO.find"
...
Modify the coercion of filter.where to hounour "allowExtendedOperators"
and don't coerce property values of type object (extended operators).
2016-12-06 10:28:40 +01:00
Miroslav Bajtoš
80d2264bc9
Merge pull request #1179 from strongloop/update/eslint
...
Upgrade eslint & config to latest
2016-12-06 10:12:11 +01:00
Loay
e14c48719e
Fix MySql CI server Failure
2016-12-05 11:42:08 -05: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
jannyHou
6c8e806bc8
Apply hasManyThrough filter on target model
2016-12-01 10:08:27 -05: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
Amir Jafarian
d908a52753
Fix a test
...
* Fix location for an instance in a test
2016-10-30 20:50:06 -04:00
Amir Jafarian
756e936c4b
Add more robust OH tests for find method
2016-10-28 16:56:38 -04:00
Amir Jafarian
54d0f5b53d
Add support for `loaded` hook
...
* Add support for loaded hook for DAO.find with near filter
2016-10-28 11:46:46 -04:00
Amir Jafarian
a65311dc7c
Use imperative mood for tests
...
* Use imperative mood for tests in test/loopback-dl.test.js
2016-10-27 16:38:40 -04:00
Heath Morrison
266e9f5a9a
Continue _coerce after logical operators
2016-10-25 23:09:46 +03:00
Amir Jafarian
212e9b1f85
Make variable names more clear
...
* Fix up #1109
2016-10-21 17:26:39 -04:00
Amirali Jafarian
d9a736a4a8
Merge pull request #1109 from C3realGuy/dev_validations
...
validateNumericality should skip undefined
2016-10-20 07:37:52 -04:00
Miroslav Bajtoš
011bfbb236
test/kvao: add connectorCapabilities options
...
- canExpire
- canQueryTtl
- ttlPrecision
- canIterateKeys
- canIterateLargeKeySets
These options allow connectors to disable shared tests for features
that are not supported/implemented.
2016-10-19 11:06:17 +02:00
CerealGuy
662458dc2c
Fix validateNumericality, nullCheck & add tests
...
validateNumericality didn't test if attributes value is a number
only if it's type is number.
Further nullCheck had a wrong testing order. It first checked if
value is null, later if blank. Also null check only used two equals,
not three. We don't use blank() anymore, testing if variable is
undefined should be fine too.
Added tests covering validateNumericality.
2016-10-15 10:59:22 +02:00
Amir Jafarian
f5e9b53289
Add test for operation hooks
...
* Add test for operation hook when near filter is used
2016-10-14 09:23:26 -04:00
Nick Duffy
a23076d3a8
Add ilike and nilike operators
...
Closes #633
2016-10-12 18:31:31 -06:00
Loay
2cb0d042e4
Fix CI Failures in MySQL
2016-09-26 20:27:33 -04: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
Amirali Jafarian
66f27b9b83
Merge pull request #1094 from strongloop/newInstance_loade_updateAttributes
...
Add 'isNewInstance' for updateAttributes
2016-09-21 09:23:57 -04:00
Amir Jafarian
fec7742a69
Add 'isNewInstance' for updateAttributes
...
* Add 'isNewInstance' to loaded hook for updateAttributes
2016-09-19 16:56:15 -04: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
Miroslav Bajtoš
a438c72cc5
Add missing "done" arg in test/kvao/ttl.suite
2016-09-08 10:22:27 +02:00
pponugo
a39c0236bb
Support nested queries for arrays
...
Enhance the built-in memory connector to correctly support nested
queries for arrays in addition to objects.
E.g. if "friends" is an array of objects containing "name", then
{ where: { "friends.name": "Jane" } } should match records containing
a friend called "Jane".
2016-09-07 13:33:57 +02:00
Simon Ho
095745c93b
Refactor TTL tests for KV memory connector
...
Reduce the complixity in the TTL test suite for the kv-memory connector
to get CI to pass.
2016-09-04 12:27:33 -07:00
Simon Ho
f102f6302b
Merge pull request #1075 from strongloop/forwardport/test-fix-for-expire
...
Fix test case for expire
2016-09-02 16:03:54 -07:00
Amirali Jafarian
d888d758c0
Merge pull request #1073 from strongloop/fix_upsertWithWhere_failures
...
Fix failures of upsertWithWhere
2016-09-02 17:01:43 -04:00
Simon Ho
b884138923
Fix test case for expire
...
Forwardport of #1074 . #1072 was missing Promise.resolve before using
delay(20) and causing Travis to fail on 2.x. This PR makes the test code
consistent on both master and 2.x.
2016-09-02 13:59:44 -07:00
Amir Jafarian
581b8c61bf
Fix failures of upsertWithWhere
...
Forwardport of #1052
2016-09-02 15:46:36 -04:00
Simon Ho
96cd8ff56b
Remove expired item before executing expire
...
The expire feature is falsely returning 204 instead of 404 because it is
not removing expired items before execution.
2016-09-01 21:18:40 -07:00
Miroslav Bajtoš
6d3ea21c16
test/memory: remove dummy findOrCreate impl
...
Let the operation-hook tests use the real implementation,
now that we have it in place.
2016-08-26 09:46:59 +02: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
Miroslav Bajtoš
3b653a192b
kvao: implement key filter
2016-08-18 09:59:56 +02:00
Miroslav Bajtoš
01ce7df60f
kvao: add iterateKeys() and keys()
...
Add a core implementation of KVAO.iterateKeys() which returns an
AsyncIterator, inspired by
- https://github.com/tc39/proposal-async-iteration
- https://www.npmjs.com/package/async-iterators
This way we can safely iterate even large sets of data.
Also add KVAO.keys(), a sugar API converting the result of iterateKeys()
into a single array.
2016-08-18 09:59:56 +02:00
Sonali Samantaray
37541dd178
upsertWithWhere feature support in juggler DAO
2016-08-16 18:06:01 +05:30
Simon Ho
e1a649ed58
Rename get test suite to match other test suites
2016-08-15 11:13:07 -07:00
Simon Ho
1c20cc83aa
Add TTL for KeyValue related features
2016-08-11 17:12:36 -07:00
Miroslav Bajtoš
b01df10eae
Merge pull request #1039 from strongloop/fix/kv-memory-reference-error
...
kv-memory: fix crash in regular cleanup
2016-08-10 14:18:11 +02:00
Janny
c4b2921977
Merge pull request #982 from strongloop/fix/auto-increment-db
...
forceId=true with auto-increment db
2016-08-09 10:02:36 -04:00
Miroslav Bajtoš
4978cd8089
kv-memory: fix crash in regular cleanup
...
Fix bug in "_setupRegularCleanup()" where the interval callback
was trying to access an object that has been garbage-collected
in the meantime.
2016-08-09 15:35:23 +02:00
Miroslav Bajtoš
baec1b5b77
test/relation: add missing error handlers
2016-08-08 16:26:26 -04:00
jannyHou
8935b978f3
forceId=true with auto-increment db
2016-08-08 16:26:26 -04:00
Miroslav Bajtoš
9ced20fdcc
kvao: return 404 when expiring unknown key
2016-08-08 17:22:33 +02:00
Miroslav Bajtoš
f15b4e2c86
Implement KeyValue API and memory connector
...
Models attached to a KeyValue connector get the following *static*
methods:
Color.set(key, value);
Color.set(key, value, ttl);
Color.set(key, value, { ttl: ttl });
Color.get(key);
Color.expire(key, ttl);
2016-08-08 10:15:34 +02: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
Supasate Choochaisri
94c5c18541
Add test to catch invalid date property
...
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-07-14 17:27:02 +07:00
Miroslav Bajtoš
699e0587d1
Ensure stable order of items in DAO.find()
...
When post-processing result of find operation, use "async.map"
instead of "async.each + array.push" to ensure the order of items
is preserved.
2016-07-13 14:55:49 +02: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
RobinBiondi
fbe58f7cf8
give options to validators #984
2016-06-24 14:44:43 -07:00
gunjpan
8117b0403f
Throw Error for property names with dots
...
Result of Compat Flags Clenup.
Throws an error for property names with dots, instead
of a deprecation warning.
2016-06-09 17:50:59 -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
Candy
3daca1e960
Remove model events
2016-06-08 10:27:05 -04:00
Dimitris Halatsis
ea2266e453
Persist changes on parent for embedsOne
...
Allow direct save of changes on embedded model to be persisted on
parent document.
Person.embedsOne(Address);
Person.findById(someId)
.then(function(p){
var address = p.addressItem();
address.street = 'new street'
// This will now persist changes on parent document
return address.save();
})
[forward-port of #949 ]
2016-06-07 17:24:59 +02:00
Amir Jafarian
8f2077e344
Fix
2016-06-03 18:00:21 -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
Dimitris Halatsis
b7ba73f1b1
ModelBuilder: add new setting strictEmbeddedModels
...
The setting controls the strict mode used for embedded property types,
for example the type of "address" property in this model definition:
modelBuilder.define('TestEmbedded', {
name: 'string',
address: {
street: 'string',
},
});
2016-06-01 13:12:50 +02:00
Miroslav Bajtoš
6ec66a7e4a
Merge pull request #950 from strongloop/add_test_description
...
Add test's description
2016-06-01 09:57:53 +02:00
Alex Pitigoi
423db34bf3
fix error handling when applying undefined mixins
2016-05-31 12:24:04 -04:00
Amir Jafarian
2b6ced06a1
Add test's description
2016-05-31 11:13:28 -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
Alex Pitigoi
0e89a9c837
fix avoid duplicate record on scope with promise
2016-05-19 15:47:31 -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š
9bde8f859b
Implement operation hooks for EmbedsMany methods
...
create() triggers
- before save
- after save
updateById() triggers
- before save
- after save
destroy() triggers
- before delete
- after delete
The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.
Limitations:
- `before save` & `after save` hooks don't provide `ctx.isNewInstance`
- async validations are not supported yet
- `persist` and `loaded` hooks are not triggered at all
- `before delete` hook does not provide `ctx.where` property and
it's not possible to change the outcome of `destroy()` using this
hook. Note that regular DAO does support this.
- updating embedded instances triggers update of the parent (owning)
model, which is correct and expected. However, the context provided
by `before save` and `after save` hooks on the parent model is sort of
arbitrary and may include wrong/extra data. The same probably applies
to the scenario when deleting embedded instances triggers update of
the parent model.
2016-04-27 11:04:15 +02:00
Miroslav Bajtoš
b86615e2b7
Implement operation hooks for EmbedsOne methods
...
create() triggers
- before save
- after save
udpate() triggers
- before save
- after save
destroy() triggers
- before delete
- after delete
The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.
2016-04-20 09:36:12 +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
4e6351b856
Fix `forceId` check for `replaceById`
2016-04-14 15:05:56 -04:00
Amir Jafarian
e9afb46eda
Fix `notify` bugs for `find`
2016-04-13 13:34:51 -04:00
Miroslav Bajtoš
09f4c7d026
test: extract hook-monitor helper
2016-04-13 13:54:17 +02:00
Miroslav Bajtoš
616a81b496
test: extract uid-generator helper
2016-04-13 13:53:31 +02:00
Miroslav Bajtoš
3435b43a5c
test: extract context-test-helpers
2016-04-13 13:52:54 +02: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
Simon Ho
85ed753609
Merge pull request #786 from strongloop/feature/fix-610
...
Partition by foreign key for pagination
2016-04-06 14:01:08 -07:00
Raymond Feng
84da11f98e
Partition by foreign key for pagination
...
See https://github.com/strongloop/loopback-datasource-juggler/issues/610
2016-04-05 17:21:48 -07:00
Raymond Feng
daaf5e381a
Merge branch 'discover-hang' of https://github.com/TorchlightSoftware/loopback-datasource-juggler into TorchlightSoftware-discover-hang
...
# Conflicts:
# lib/datasource.js
# test/discovery.test.js
2016-04-05 16:18:25 -07:00
Raymond Feng
e321bafdf9
Fix style errors
2016-04-05 16:11:25 -07:00
Raymond Feng
b7543e9402
Merge pull request #860 from horiaradu/master
...
fix nin support for in memory datasource
2016-04-05 15:42:07 -07: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
Miroslav Bajtoš
fc1aefb8d4
Add eslint as "npm run lint" and "posttest" hook
2016-04-05 15:25:34 +02:00
Ryan Graham
c467b43c38
Insert copyright headers
2016-04-04 18:14:03 -07:00
Amir Jafarian
5b6bffb5b3
Fix Mongo compatibility issue
...
*Fix Mongo compatibility issue for replaceOrCreate
2016-03-29 14:42:13 -04:00
Amir Jafarian
8b8d474b92
Add automigrate to setup tables for replace test cases
2016-03-29 12:21:10 -04:00
Amir-61
fc27aa9561
Merge pull request #868 from strongloop/mySQL-fix-tests
...
Fix tests for mysql
2016-03-28 15:57:27 -04:00
bitmage
57afba8c51
support custom field settings under the connector's namespace
2016-03-16 09:17:55 -07:00
Amir Jafarian
024bff6a91
Fix tests for mysql
2016-03-08 20:39:25 -05:00
Miroslav Bajtoš
28e07d9df3
Add forgotten unit test
...
The test should have been added as part of #859
2016-03-02 12:32:11 +01:00
Horia Radu
a3ae44aca0
fix nin support for in memory datasource
2016-02-27 10:27:09 +02:00
Amir Jafarian
2281e95940
Implementtaion of replace
...
This includes:
*implementation of replaceAttributes
*implementtaion of replaceOrCreate
2016-02-03 16:06:35 -05:00
Jue Hou
0d9eebe3bb
Prevent constructor to be property name
2016-02-02 11:51:05 -05:00
bitmage
b556d96148
discoverSchemas returns an error when modelName is not found,
...
discoverSchema forwards that error and does not hang when no columns,
no errors are returned
2016-01-22 10:41:06 -07:00
Tom Kirkpatrick
61047a028d
Add unit test to verify fix for #754
2016-01-21 18:00:45 -08:00
Amir Jafarian
ba7161b39e
Implement `findOrCreate` for memory connector
2016-01-16 18:46:53 -05:00
Jue Hou
853ca03491
Use bluebird in utils.js
...
Replace `global.Promise` with `bluebird`
2016-01-07 15:27:33 -05:00
Miroslav Bajtoš
b509c759c4
Merge pull request #796 from strongloop/fix/various
...
Various fixes in operation hooks
2016-01-05 11:08:35 +01:00
Simon Ho
5d453b5038
Revert "Correct syntax for should and more"
...
This reverts commit 62de2ed69e
.
2015-12-23 15:41:16 -08:00
Simon Ho
b63133d1d6
Fix test for shouldjs 8.0.2 upgrade
2015-12-22 15:03:50 -08:00
Miroslav Bajtoš
e9899a93cf
Enhance "persist" hook in DAO.updateOrCreate
...
Report `ctx.isNewInstance` when the connector provides this info.
2015-12-18 16:08:38 +01:00
Miroslav Bajtoš
fd9bef4aa7
Enhance "persisted" hook in DAO.updateAttributes
...
Add `isNewInstance:false` to the context reported by
DAO.updateAttributes()
2015-12-18 16:08:01 +01:00
Miroslav Bajtoš
3028329126
"loaded" hook in DAO.find: ctx.data, not instance
...
Fix the implementation od DAO.find to provide "ctx.data" to the
"loaded" hook.
2015-12-18 15:54:35 +01:00
Amir Jafarian
62de2ed69e
Correct syntax for should and more
...
This fixes lots of failures in connectors
2015-12-16 16:24:48 -05:00
Simon Ho
9cfda16194
Fix failing test for MongoDB connector
2015-12-09 12:58:21 -08:00
Miroslav Bajtoš
80c3bd9d41
Merge pull request #752 from ernie58/optionalValidation
...
make automatic validation optional
2015-12-04 17:03:28 +01:00
Bert Casier
0f3f27af51
Make automatic validation optional
...
Make automatic validation optional on all CRUD methods in a loopback
model. This can be done in 2 ways
- set `automaticValidation` in the model settings
- set `validate` on the options passed when calling the crud methods
The options take precedence on the model setting.
By default the automatic validation remains true to be backwards
compatible
2015-12-03 16:34:25 +01:00
Raymond Feng
6f7fc5030a
Merge branch 'fix_update_attributes_error' of https://github.com/wpjunior/loopback-datasource-juggler into wpjunior-fix_update_attributes_error
2015-11-26 09:31:40 -08:00
Raymond Feng
bd314e6a87
Merge branch 'with-simpe-and-fast-hasmany' of https://github.com/wertlex/loopback-datasource-juggler into wertlex-with-simpe-and-fast-hasmany
2015-11-23 15:21:18 -08:00
Michael Diguet
d8678a1f03
Correction of a regression introduced by commit 632898b: when querying an empty array ([]) with a 'neq' filter, there were no matching.
2015-11-23 17:09:24 +01:00
Raymond Feng
d7bbd7e215
Fix the typo
2015-11-17 13:27:41 -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
Wert_Lex
d9918d526a
dropped unused functions and tests fixed
2015-10-30 21:36:50 +06:00
Wert_Lex
638002bc59
Looks better now
2015-10-30 21:15:48 +06:00
mdartic
ef7fe45d9c
Rewrite of variable
2015-10-16 18:25:23 +02:00
mdartic
7c22db6ea7
Filtering relations of a model with an order specified
2015-10-16 18:21:04 +02:00
Wert_Lex
0864bf7154
with updated map which stores original key and tests for them
2015-10-10 19:21:06 +05:00
Ryan Schumacher
94c3f9a432
Ability to define normalization of undefined query
...
Add datasource and model setting `normalizeUndefinedInQuery`
to determine how it will handle undefined values. Options:
- nullify : converts undefined to null
- throw : throw an error on undefined value
- ignore : strip the key where undefined value is found
The default operation is to strip the key.
2015-10-07 09:26:09 -07:00
Raymond Feng
1e035c657e
Fix the test so that it works across DBs
2015-09-11 11:15:00 -07:00
Raymond Feng
a6519bb2ca
Fix id comparision in tests so that they work with mongodb object id
2015-09-08 09:53:02 -07:00
Raymond Feng
207edd5eec
Merge pull request #687 from sklyukin/master
...
primaryKey to hasOne relation
2015-09-08 09:20:42 -07:00
Bram Borggreve
fb11c78be0
Add support for using UUID V4 as defaultFn
2015-09-02 16:39:00 +02:00
sklyukin
d0f9b760f5
primaryKey for hasMany and belongsTo relations
2015-09-01 19:03:02 +05:00
sklyukin
483cd873e7
primaryKey to hasOne relation
2015-09-01 01:31:28 +05:00
Laurent Villeneuve
cb78c8ef96
Add direct copmarison value for array matching
2015-08-27 23:56:49 -04:00
Laurent Villeneuve
632898b022
Add support for matching array values à la mongo.
2015-08-27 23:32:53 -04:00
Raymond Feng
682f6340d3
Optimze automigrate() to cut the test time signicantly
2015-08-27 15:59:58 -07:00
Simon Ho
57a9c40e16
Fix primary key checks
2015-08-27 13:59:43 -07:00
Wert_Lex
fb56915371
Dirty merge. Tests are broken
2015-08-24 16:07:43 +03:00
Wert_Lex
e585021586
include utils add. Tests ported to should.js
2015-08-24 15:41:04 +03:00
Simon Ho
cd71a37bfa
Relax id requirement for basic query operations
2015-08-20 02:57:53 -07:00
Laurent Villeneuve
0381f6d7e7
Support embedded query in memory connector. Fix memory connector bug
...
Adds support for the ability to query embedsMany models from the parent.
Fix a memory connector bug that could occur when having an "or" or "and"
clause combined with another property. In that case, the and would revert
true for 'Paul McCartney'
```
{name:'John Lennon',and: [{role:'lead'}, {vip:true}]}}
```
2015-08-18 15:56:36 -04:00
Simon Ho
d14721656f
Merge pull request #691 from strongloop/do-not-coerce-regexp-to-string
...
Do not coerce RegExp objects to strings
2015-08-14 09:14:05 -07:00
Simon Ho
e7e074f97b
Do not coerce RegExp objects to strings
...
Queries like `{where: {name: /John.*/i}}` should work. Notice there is no
`regexp` operator (ie. `{where: {name: {regexp: /John.*/i}}}`).
2015-08-13 16:16:48 -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
Kenta Fried
90ee9a1af3
fixes issue 673: Include hasMany of relation does not return empty array
2015-07-31 14:47:22 -07:00
Raymond Feng
6513d9658f
Fix the test case with automigrate
2015-07-30 11:24:47 -07:00
Raymond Feng
c45bde7ccf
Merge pull request #647 from PradnyaBaviskar/issue-418-discover
...
Promisify all 'discover' methods
2015-07-29 07:43:39 -07:00
Raymond Feng
ce57234d5e
Merge branch 'issue656-findLoadedAsync' of https://github.com/PradnyaBaviskar/loopback-datasource-juggler into PradnyaBaviskar-issue656-findLoadedAsync
2015-07-29 07:33:21 -07:00
Simon Ho
fee103d9d7
Remove test for unused utility function
2015-07-28 17:45:38 -07:00
Simon Ho
b2b5a0d920
Merge pull request #665 from strongloop/add-regex-support
...
Add support for RegExp operator
2015-07-28 15:22:02 -07:00
Simon Ho
b8f1598723
Add support for regex operator
2015-07-27 15:11:53 -07:00
Pradnya Baviskar
de0ca3c61f
Async 'loaded' hook for find
2015-07-27 18:58:29 +05:30
Pradnya Baviskar
c63f3fb6cb
Promisify all 'discover' methods
2015-07-24 12:07:22 +05:30
Raymond Feng
b08b6dd954
Merge pull request #650 from PradnyaBaviskar/issue-649
...
Fix 'persist' hook for updateAttributes()
2015-07-23 08:27:07 -07:00