dobo 1.0.10 → 1.0.12
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function buildPageSkipLimit (filter) {
|
|
2
2
|
let limit = parseInt(filter.limit) || this.config.default.filter.limit
|
|
3
|
+
if (limit === -1) limit = this.config.default.filter.maxLimit
|
|
3
4
|
if (limit > this.config.default.filter.maxLimit) limit = this.config.default.filter.maxLimit
|
|
4
5
|
if (limit < 1) limit = 1
|
|
5
6
|
let page = parseInt(filter.page) || 1
|
|
@@ -28,8 +28,8 @@ async function count (name, filter = {}, opts = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
const count = await handler.call(this.app[driver.ns], { schema, filter, options })
|
|
30
30
|
if (!noHook) {
|
|
31
|
-
await runHook(`${this.name}.${camelCase(name)}:
|
|
32
|
-
await runHook(`${this.name}:
|
|
31
|
+
await runHook(`${this.name}.${camelCase(name)}:afterRecordCount`, filter, options, count)
|
|
32
|
+
await runHook(`${this.name}:afterRecordCount`, name, filter, options, count)
|
|
33
33
|
}
|
|
34
34
|
if (set && !noCache) await set({ model: name, filter, options, count })
|
|
35
35
|
return dataOnly ? count.data : count
|
|
@@ -9,12 +9,15 @@ async function findOne (name, filter = {}, opts = {}) {
|
|
|
9
9
|
options.req = opts.req
|
|
10
10
|
options.dataOnly = options.dataOnly ?? true
|
|
11
11
|
let { fields, dataOnly, noHook, noCache, hidden, forceNoHidden } = options
|
|
12
|
-
await this.modelExists(name, true)
|
|
13
|
-
filter.limit = 1
|
|
14
12
|
options.count = false
|
|
15
13
|
options.dataOnly = false
|
|
14
|
+
await this.modelExists(name, true)
|
|
15
|
+
filter.limit = 1
|
|
16
16
|
const { handler, schema, driver } = await resolveMethod.call(this, name, 'record-find', options)
|
|
17
17
|
if (!schema.cacheable) noCache = true
|
|
18
|
+
filter.query = await this.buildQuery({ filter, schema, options }) ?? {}
|
|
19
|
+
if (options.queryHandler) filter.query = await options.queryHandler.call(opts.req ? this.app[opts.req.ns] : this, filter.query, opts.req)
|
|
20
|
+
filter.match = this.buildMatch({ input: filter.match, schema, options }) ?? {}
|
|
18
21
|
if (!noHook) {
|
|
19
22
|
await runHook(`${this.name}:beforeRecordFindOne`, name, filter, options)
|
|
20
23
|
await runHook(`${this.name}.${camelCase(name)}:beforeRecordFindOne`, filter, options)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"field": {
|
|
3
3
|
"id": "ID",
|
|
4
|
+
"code": "Kode",
|
|
4
5
|
"name": "Name",
|
|
5
6
|
"dt": "Date/Time",
|
|
6
7
|
"createdAt": "Created At",
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
"theme": "Theme",
|
|
51
52
|
"token": "Token",
|
|
52
53
|
"field": "Field",
|
|
53
|
-
"agree": "Agreement"
|
|
54
|
+
"agree": "Agreement",
|
|
55
|
+
"method": "Metode"
|
|
54
56
|
},
|
|
55
57
|
"validation": {
|
|
56
58
|
"any.required": "Required",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"Data Export": "Ekspor Data",
|
|
75
75
|
"field": {
|
|
76
76
|
"id": "ID",
|
|
77
|
+
"code": "Kode",
|
|
77
78
|
"name": "Nama",
|
|
78
79
|
"dt": "Tgl/Jam",
|
|
79
80
|
"createdAt": "Dibuat Pada",
|
|
@@ -123,7 +124,8 @@
|
|
|
123
124
|
"theme": "Tema",
|
|
124
125
|
"token": "Token",
|
|
125
126
|
"field": "Field",
|
|
126
|
-
"agree": "Persetujuan"
|
|
127
|
+
"agree": "Persetujuan",
|
|
128
|
+
"method": "Metode"
|
|
127
129
|
},
|
|
128
130
|
"Validation Error": "Kesalahan Validasi",
|
|
129
131
|
"validation": {
|