dobo 1.1.16 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bajo/intl/en-US.json
CHANGED
package/bajo/intl/id.json
CHANGED
package/package.json
CHANGED
package/plugin/factory.js
CHANGED
|
@@ -267,10 +267,15 @@ async function factory (pkgName) {
|
|
|
267
267
|
buildQuery = async ({ filter, schema, options = {} } = {}) => {
|
|
268
268
|
const { trim, isString, isPlainObject } = this.lib._
|
|
269
269
|
let query = {}
|
|
270
|
+
if (schema.name === 'SeatrackVessel') this.app.dump(filter)
|
|
270
271
|
if (isString(filter.query)) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
try {
|
|
273
|
+
filter.oquery = filter.query
|
|
274
|
+
if (trim(filter.query).startsWith('{')) query = JSON.parse(filter.query)
|
|
275
|
+
else query = nql(filter.query).parse()
|
|
276
|
+
} catch (err) {
|
|
277
|
+
this.error('invalidQuery', { orgMessage: err.message })
|
|
278
|
+
}
|
|
274
279
|
} else if (isPlainObject(filter.query)) query = filter.query
|
|
275
280
|
return this.sanitizeQuery(query, schema)
|
|
276
281
|
}
|
|
@@ -16,6 +16,7 @@ async function findOne (name, filter = {}, opts = {}) {
|
|
|
16
16
|
options.dataOnly = false
|
|
17
17
|
await this.modelExists(name, true)
|
|
18
18
|
filter.limit = 1
|
|
19
|
+
filter.page = 1
|
|
19
20
|
const { handler, schema, driver } = await resolveMethod.call(this, name, 'record-find', options)
|
|
20
21
|
if (!schema.cacheable) noCache = true
|
|
21
22
|
filter.query = await this.buildQuery({ filter, schema, options }) ?? {}
|
|
@@ -34,6 +35,7 @@ async function findOne (name, filter = {}, opts = {}) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
filter.limit = 1
|
|
38
|
+
filter.page = 1
|
|
37
39
|
const record = options.record ?? (await handler.call(this.app[driver.ns], { schema, filter, options }))
|
|
38
40
|
delete options.record
|
|
39
41
|
record.data = record.data[0]
|