simplify response of transaction records

This commit is contained in:
zhl 2023-02-08 09:59:41 +08:00
parent 5cb1322d80
commit a972435a8d
3 changed files with 3 additions and 3 deletions

View File

@ -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
}

View File

@ -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 }
}

View File

@ -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()),
}
}
}