waibu-db 2.2.0 → 2.2.1
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/crud/add-handler.js
CHANGED
|
@@ -10,6 +10,7 @@ async function addHandler ({ req, reply, model, params = {}, template, addOnsHan
|
|
|
10
10
|
if (schema.disabled.includes('create')) return await reply.view(templateDisabled, { action: 'add' })
|
|
11
11
|
// req.query.attachment = true
|
|
12
12
|
opts.fields = schema.view.fields
|
|
13
|
+
delete req.query.query
|
|
13
14
|
let def = {}
|
|
14
15
|
if (req.method === 'GET' && req.query.mode === 'clone' && req.query.id) {
|
|
15
16
|
const resp = await getRecord({ model, req, id: req.query.id, options: { fields: map(schema.properties, 'name') } })
|
|
@@ -8,6 +8,7 @@ async function deleteHandler ({ req, reply, model, params = {}, templateDisabled
|
|
|
8
8
|
const { schema } = await getSchemaExt(model, 'add', merge({}, { params }, options))
|
|
9
9
|
if (schema.disabled.includes('remove')) return await reply.view(templateDisabled, { action: 'delete' })
|
|
10
10
|
opts.fields = schema.view.fields
|
|
11
|
+
delete req.query.query
|
|
11
12
|
const ids = (req.body.ids ?? '').split(',')
|
|
12
13
|
if (ids.length > 0) {
|
|
13
14
|
const result = []
|
|
@@ -11,6 +11,7 @@ async function detailsHandler ({ req, reply, model, params = {}, id, template, a
|
|
|
11
11
|
// req.query.attachment = true
|
|
12
12
|
opts.fields = schema.view.fields
|
|
13
13
|
id = id ?? req.params.id ?? req.query.id
|
|
14
|
+
delete req.query.query
|
|
14
15
|
const resp = await getRecord({ model, req, id, options: opts })
|
|
15
16
|
const form = resp.data
|
|
16
17
|
const addOns = addOnsHandler ? await addOnsHandler.call(this.app[req.ns], { req, reply, params, data: resp, schema, options }) : undefined
|
package/lib/crud/edit-handler.js
CHANGED
|
@@ -18,6 +18,7 @@ async function editHandler ({ req, reply, model, id, params = {}, template, addO
|
|
|
18
18
|
// req.query.attachment = true
|
|
19
19
|
opts.fields = schema.view.fields
|
|
20
20
|
id = id ?? req.params.id ?? req.query.id
|
|
21
|
+
delete req.query.query
|
|
21
22
|
const old = await getRecord({ model, req, id, options: opts })
|
|
22
23
|
form = defaultsDeep(req.body, old.data)
|
|
23
24
|
if (req.method !== 'GET') {
|