diff --git a/backend/src/typeorm/repository/User.ts b/backend/src/typeorm/repository/User.ts index f9faf6c5b..3155053d9 100644 --- a/backend/src/typeorm/repository/User.ts +++ b/backend/src/typeorm/repository/User.ts @@ -10,20 +10,15 @@ export class UserRepository extends Repository { } async getUsersIndiced(userIds: number[]): Promise { - if (!userIds.length) return [] - const users = await this.createQueryBuilder('user') + return this.createQueryBuilder('user') + .withDeleted() // We need to show the name for deleted users for old transactions .select(['user.id', 'user.firstName', 'user.lastName', 'user.email']) - .where('user.id IN (:...users)', { users: userIds }) + .where('user.id IN (:...userIds)', { userIds }) .getMany() - const usersIndiced: User[] = [] - users.forEach((value) => { - usersIndiced[value.id] = value - }) - return usersIndiced } async findBySearchCriteria(searchCriteria: string): Promise { - return await this.createQueryBuilder('user') + return this.createQueryBuilder('user') .withDeleted() .where( 'user.firstName like :name or user.lastName like :lastName or user.email like :email',