waibu-db 2.3.3 → 2.5.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/index.js CHANGED
@@ -8,6 +8,7 @@ import getSchemaExt from './lib/method/get-schema-ext.js'
8
8
  import getRecord from './lib/method/get-record.js'
9
9
  import removeRecord from './lib/method/remove-record.js'
10
10
  import updateRecord from './lib/method/update-record.js'
11
+ import findAllRecord from './lib/method/find-all-record.js'
11
12
 
12
13
  /**
13
14
  * Plugin factory
@@ -62,7 +63,8 @@ async function factory (pkgName) {
62
63
  'getSchemaExt',
63
64
  'getRecord',
64
65
  'removeRecord',
65
- 'updateRecord'
66
+ 'updateRecord',
67
+ 'findAllRecord'
66
68
  ])
67
69
  }
68
70
 
@@ -180,6 +182,7 @@ async function factory (pkgName) {
180
182
  const rec = cloneDeep(data)
181
183
  const lang = get(req, 'lang')
182
184
  const unitSys = get(req, 'site.setting.sumba.unitSys')
185
+ const timeZone = get(req, 'site.setting.sumba.timeZone', this.app.bajo.config.intl.format.datetime.timeZone)
183
186
  for (const f of fields) {
184
187
  if (f === '_rel') continue
185
188
  let prop = find(schema.properties, { name: f })
@@ -192,7 +195,10 @@ async function factory (pkgName) {
192
195
  speed: ['speed'].includes(f),
193
196
  degree: ['course', 'heading'].includes(f),
194
197
  distance: ['distance'].includes(f),
195
- unitSys: options.unitSys ?? unitSys
198
+ unitSys: options.unitSys ?? unitSys,
199
+ datetime: options.datetime ?? { timeZone },
200
+ date: options.date ?? { timeZone },
201
+ time: options.time ?? { timeZone }
196
202
  }
197
203
  rec[f] = format(data[f], prop.type, opts)
198
204
  const vf = get(schema, `view.valueFormatter.${f}`)
@@ -210,6 +216,7 @@ async function factory (pkgName) {
210
216
  createRecord = createRecord
211
217
  findOneRecord = findOneRecord
212
218
  findRecord = findRecord
219
+ findAllRecord = findAllRecord
213
220
  getSchemaExt = getSchemaExt
214
221
  getRecord = getRecord
215
222
  removeRecord = removeRecord
@@ -0,0 +1,14 @@
1
+ import { prepCrud } from '../util.js'
2
+
3
+ async function findAllRecord ({ model, req, reply, options = {} }) {
4
+ const { model: mdl, opts, filter, attachment, stats, mimeType } = await prepCrud.call(this, { model, req, reply, options, args: ['model'] })
5
+ const ret = await mdl.findAllRecord(filter, opts)
6
+ if (attachment) {
7
+ for (const d of ret.data) {
8
+ d._attachment = await mdl.findAttachment(d.id, { stats, mimeType })
9
+ }
10
+ }
11
+ return ret
12
+ }
13
+
14
+ export default findAllRecord
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.3.3",
3
+ "version": "2.5.0",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-02-15
4
+
5
+ - [2.5.0] Add ```findAllRecord()```
6
+
7
+ ## 2026-02-08
8
+
9
+ - [2.4.0] Add ```timeZone``` options in ```formatRow()```
10
+
3
11
  ## 2026-02-04
4
12
 
5
13
  - [2.3.2] Bug fix on ```detailsHandler()```