server: fix response with createUser

This commit is contained in:
fantasticit 2022-05-17 09:52:34 +08:00
parent 1d0356d4f5
commit 2a3bedcbfe
1 changed files with 4 additions and 4 deletions

View File

@ -130,14 +130,14 @@ export class TemplateService {
query.take(+pageSize); query.take(+pageSize);
const [data, count] = await query.getManyAndCount(); const [data, count] = await query.getManyAndCount();
await Promise.all( const ret = await Promise.all(
data.map(async (template) => { data.map(async (template) => {
const createUser = await this.userService.findById(template.createUserId); const createUser = await this.userService.findById(template.createUserId);
return { ...template, createUser }; return { ...template, createUser };
}) })
); );
return { data, total: count }; return { data: ret, total: count };
} }
/** /**
@ -156,13 +156,13 @@ export class TemplateService {
query.take(+pageSize); query.take(+pageSize);
const [data, count] = await query.getManyAndCount(); const [data, count] = await query.getManyAndCount();
await Promise.all( const ret = await Promise.all(
data.map(async (template) => { data.map(async (template) => {
const createUser = await this.userService.findById(template.createUserId); const createUser = await this.userService.findById(template.createUserId);
return { ...template, createUser }; return { ...template, createUser };
}) })
); );
return { data, total: count }; return { data: ret, total: count };
} }
} }