waibu-db 2.2.0 → 2.2.2
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') } })
|
|
@@ -32,7 +33,6 @@ async function addHandler ({ req, reply, model, params = {}, template, addOnsHan
|
|
|
32
33
|
form._addmore = req.session[`wdb${model}AddMore`]
|
|
33
34
|
form._cloneprev = req.session[`wdb${model}ClonePrev`]
|
|
34
35
|
}
|
|
35
|
-
console.log(form)
|
|
36
36
|
const addOns = addOnsHandler ? await addOnsHandler.call(this.app[req.ns], { req, reply, params, data: resp, schema, error, options }) : undefined
|
|
37
37
|
merge(params, { form, schema, error, addOns })
|
|
38
38
|
if (schema.template) template = schema.template
|
|
@@ -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') {
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## 2026-01-24
|
|
4
4
|
|
|
5
|
+
- [2.2.2] Remove annoying console.log trap
|
|
6
|
+
|
|
7
|
+
## 2026-01-24
|
|
8
|
+
|
|
5
9
|
- [2.2.0] Model's option can now be sent through ```modelOpts``` object in ```options``` handler
|
|
6
10
|
- [2.2.0] ```prepCrud()``` now accept model instance or model name only
|
|
7
11
|
- [2.2.0] ```getSchemaExt``` now accept model instance or model name only
|