server: fix get version data

This commit is contained in:
fantasticit 2022-05-26 12:58:49 +08:00
parent c1db90aa21
commit 62839b1ff3
1 changed files with 8 additions and 5 deletions

View File

@ -23,7 +23,10 @@ export class DocumentVersionService {
private async withUser(data: Array<Omit<VerisonDataItem, 'createUser'>>): Promise<VerisonDataItem[]> { private async withUser(data: Array<Omit<VerisonDataItem, 'createUser'>>): Promise<VerisonDataItem[]> {
return await Promise.all( return await Promise.all(
data.filter(Boolean).map(async (record) => { data
.filter(Boolean)
.filter((record) => record.userId)
.map(async (record) => {
const { userId } = record; const { userId } = record;
const createUser = await this.userService.findById(userId); const createUser = await this.userService.findById(userId);
return { ...record, createUser }; return { ...record, createUser };