simplify response of transaction records
This commit is contained in:
parent
5cb1322d80
commit
a972435a8d
@ -23,7 +23,7 @@ class RecordController extends BaseController {
|
||||
let defaultParams: any = { account: user.id }
|
||||
let { params } = req
|
||||
Object.assign(params, defaultParams)
|
||||
const records = await TranRecord.pageQuery(params)
|
||||
const records = await TranRecord.pageQuery(params, {json: 1})
|
||||
return records
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ export abstract class BaseModule extends FindOrCreate {
|
||||
let records = await this.find(opt).sort(sort).skip(start).limit(limit)
|
||||
let total = await this.countDocuments(opt)
|
||||
if (options?.json) {
|
||||
records.map((o: T) => o.toJson())
|
||||
records = records.map((o: T) => o.toJson())
|
||||
}
|
||||
return { records, total, start, limit }
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class TranRecordClass extends BaseModule {
|
||||
status: this.status,
|
||||
startTime: this.startTime,
|
||||
confirmTime: this.confirmTime,
|
||||
details: this.details.forEach(o => o.toJson()),
|
||||
details: this.details.map(o => o.toJson()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user