waibu-db 2.30.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 +7 -2
- package/package.json +1 -1
- package/wiki/CHANGES.md +5 -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,11 @@ 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
|
+
|
|
44
|
+
data.opts.timeZone = get(req, 'site.setting.sumba.timeZone', this.app.bajo.config.intl.format.datetime.timeZone)
|
|
45
|
+
data.opts.dateStyle = get(req, 'site.setting.sumba.dateStyle', this.app.bajo.config.intl.format.datetime.dateStyle)
|
|
46
|
+
data.opts.timeStyle = get(req, 'site.setting.sumba.timeStyle', this.app.bajo.config.intl.format.datetime.timeStyle)
|
|
42
47
|
const source = `${this.name}:/export-handler`
|
|
43
48
|
const worker = 'waibuDb:exportData'
|
|
44
49
|
const type = get(data, 'input.ftype', 'json')
|
|
@@ -46,7 +51,7 @@ async function exportHandler (opts = {}) {
|
|
|
46
51
|
const ext = data.exportOpts.includes('zip') ? `${type}.gz` : type
|
|
47
52
|
// const file = `${kebabCase(model)}_${dayjs().format('YYYYMMDDhhmmss')}.${ext}`
|
|
48
53
|
const file = `${kebabCase(model)}.${ext}`
|
|
49
|
-
if (this.app.
|
|
54
|
+
if (this.app.sumba) {
|
|
50
55
|
await this.app.sumba.download({ file, type, worker, source, data, req })
|
|
51
56
|
req.flash('notify', req.t('exportInQueue'))
|
|
52
57
|
} else {
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-07-27
|
|
4
|
+
|
|
5
|
+
- [2.32.0] Add support for `sumba.download()` through `export-handler.js`
|
|
6
|
+
|
|
3
7
|
## 2026-07-26
|
|
4
8
|
|
|
5
9
|
- [2.30.0] Canges in `exportTo()`
|
|
6
10
|
- [2.30.0] Bug fix in `btn-export.js`
|
|
7
11
|
- [2.30.0] Bug fix in `export-handler.js`
|
|
12
|
+
- [2.31.0] Add support for `i18n` options in `export-handler.js`
|
|
8
13
|
|
|
9
14
|
## 2026-07-25
|
|
10
15
|
|