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 defaultParams: any = { account: user.id }
|
||||||
let { params } = req
|
let { params } = req
|
||||||
Object.assign(params, defaultParams)
|
Object.assign(params, defaultParams)
|
||||||
const records = await TranRecord.pageQuery(params)
|
const records = await TranRecord.pageQuery(params, {json: 1})
|
||||||
return records
|
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 records = await this.find(opt).sort(sort).skip(start).limit(limit)
|
||||||
let total = await this.countDocuments(opt)
|
let total = await this.countDocuments(opt)
|
||||||
if (options?.json) {
|
if (options?.json) {
|
||||||
records.map((o: T) => o.toJson())
|
records = records.map((o: T) => o.toJson())
|
||||||
}
|
}
|
||||||
return { records, total, start, limit }
|
return { records, total, start, limit }
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class TranRecordClass extends BaseModule {
|
|||||||
status: this.status,
|
status: this.status,
|
||||||
startTime: this.startTime,
|
startTime: this.startTime,
|
||||||
confirmTime: this.confirmTime,
|
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