diff --git a/packages/server/src/services/document-version.service.ts b/packages/server/src/services/document-version.service.ts index 1e029b4..2422280 100644 --- a/packages/server/src/services/document-version.service.ts +++ b/packages/server/src/services/document-version.service.ts @@ -23,11 +23,14 @@ export class DocumentVersionService { private async withUser(data: Array>): Promise { 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 }; + }) ); }