skip undefined userId

This commit is contained in:
Dan Percic 2022-07-27 14:48:02 +03:00
parent 3906421aa0
commit 91777db7fb

View File

@ -84,6 +84,10 @@ export abstract class BaseUserService<
}
getName(user: string | Interface | Class): string | undefined {
if (!user) {
return;
}
const userId = typeof user === 'string' ? user : user.userId;
return this.find(userId)?.name;
}