dobo 2.2.1 → 2.2.3
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/lib/factory/driver.js +4 -3
- package/package.json +2 -2
- package/wiki/CHANGES.md +5 -0
package/lib/factory/driver.js
CHANGED
|
@@ -51,7 +51,8 @@ async function driverFactory () {
|
|
|
51
51
|
conn.memory = false
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
sanitizeBody (model, body = {}) {
|
|
54
|
+
sanitizeBody (model, body = {}, partial) {
|
|
55
|
+
const { keys, pick } = this.app.lib._
|
|
55
56
|
const item = cloneDeep(body)
|
|
56
57
|
if (has(item, 'id') && this.idField.name !== 'id') {
|
|
57
58
|
item[this.idField.name] = item.id
|
|
@@ -74,7 +75,7 @@ async function driverFactory () {
|
|
|
74
75
|
else if (['object', 'array'].includes(prop.type)) item[prop.name] = JSON.stringify(item[prop.name])
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
return item
|
|
78
|
+
return partial ? pick(item, keys(body)) : item
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
sanitizeRecord (model, record = {}) {
|
|
@@ -212,7 +213,7 @@ async function driverFactory () {
|
|
|
212
213
|
const resp = await this.getRecord(model, id, { noHook: true })
|
|
213
214
|
if (!resp.data) throw this.plugin.error('recordNotFound%s%s', id, model.name)
|
|
214
215
|
options._data = resp.data
|
|
215
|
-
const input = this.sanitizeBody(model, body)
|
|
216
|
+
const input = this.sanitizeBody(model, body, true)
|
|
216
217
|
delete input.id
|
|
217
218
|
const result = await this.updateRecord(model, id, input, options)
|
|
218
219
|
if (options.noResult) return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dobo",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "DBMS for Bajo Framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@tryghost/nql": "^0.12.7",
|
|
36
36
|
"joi": "^18.0.2",
|
|
37
|
-
"mingo": "^
|
|
37
|
+
"mingo": "^6.5.1",
|
|
38
38
|
"ulid": "^3.0.2",
|
|
39
39
|
"uuid": "^13.0.0"
|
|
40
40
|
},
|