waibu-db 2.31.0 → 2.32.0
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/export-handler.js +4 -2
- package/package.json +1 -1
- package/wiki/CHANGES.md +4 -0
|
@@ -27,7 +27,7 @@ async function exportHandler (opts = {}) {
|
|
|
27
27
|
options = {}
|
|
28
28
|
} = opts
|
|
29
29
|
// const { dayjs } = this.app.lib
|
|
30
|
-
const { omit, kebabCase, get, merge } = this.app.lib._
|
|
30
|
+
const { omit, kebabCase, get, merge, isEmpty } = this.app.lib._
|
|
31
31
|
const { pascalCase } = this.app.lib.aneka
|
|
32
32
|
const { getSchemaExt } = this.app.waibuDb
|
|
33
33
|
const { buildUrl } = this.app.waibuMpa
|
|
@@ -39,6 +39,8 @@ async function exportHandler (opts = {}) {
|
|
|
39
39
|
const data = await prepCrud.call(this.app.getPlugin('waibuDb'), { model, req, reply, args: ['model'] })
|
|
40
40
|
data.opts = omit(data.opts, ['req', 'reply'])
|
|
41
41
|
data.opts.lang = req.lang
|
|
42
|
+
data.opts.fields = isEmpty(req.query.fields) ? get(schema, 'view.fields', []) : req.query.fields.split(',')
|
|
43
|
+
|
|
42
44
|
data.opts.timeZone = get(req, 'site.setting.sumba.timeZone', this.app.bajo.config.intl.format.datetime.timeZone)
|
|
43
45
|
data.opts.dateStyle = get(req, 'site.setting.sumba.dateStyle', this.app.bajo.config.intl.format.datetime.dateStyle)
|
|
44
46
|
data.opts.timeStyle = get(req, 'site.setting.sumba.timeStyle', this.app.bajo.config.intl.format.datetime.timeStyle)
|
|
@@ -49,7 +51,7 @@ async function exportHandler (opts = {}) {
|
|
|
49
51
|
const ext = data.exportOpts.includes('zip') ? `${type}.gz` : type
|
|
50
52
|
// const file = `${kebabCase(model)}_${dayjs().format('YYYYMMDDhhmmss')}.${ext}`
|
|
51
53
|
const file = `${kebabCase(model)}.${ext}`
|
|
52
|
-
if (this.app.
|
|
54
|
+
if (this.app.sumba) {
|
|
53
55
|
await this.app.sumba.download({ file, type, worker, source, data, req })
|
|
54
56
|
req.flash('notify', req.t('exportInQueue'))
|
|
55
57
|
} else {
|
package/package.json
CHANGED