dobo 2.2.2 → 2.2.4
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.
|
@@ -6,7 +6,7 @@ async function attachment (req, reply) {
|
|
|
6
6
|
const { routePath } = this.app.waibu
|
|
7
7
|
const { fs } = this.app.lib
|
|
8
8
|
const mdl = this.app.dobo.getModel(req.params.model)
|
|
9
|
-
const items = await mdl.listAttachments(req.params.id, req.params.field, '*')
|
|
9
|
+
const items = await mdl.listAttachments({ id: req.params.id, fieldName: req.params.field, file: '*' })
|
|
10
10
|
let item = req.params.file === '_first' ? items[0] : undefined
|
|
11
11
|
if (!item) {
|
|
12
12
|
item = find(items, i => {
|
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
package/wiki/CHANGES.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-01-19
|
|
4
|
+
|
|
5
|
+
- [2.2.4] Bug fix on route ```dobo:/attachment/...```
|
|
6
|
+
|
|
3
7
|
## 2026-01-18
|
|
4
8
|
|
|
5
9
|
- [2.2.2] Revert back to ```mingo@6.5.1``` because of bugs in ```skip``` operation
|
|
10
|
+
- [2.2.3] Bug fix on driver's ```sanitizeBody()```
|
|
6
11
|
|
|
7
12
|
## 2026-01-16
|
|
8
13
|
|