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