mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
simplified query and also include withDeleted to show the name of an user marked as deleted
This commit is contained in:
parent
ecfcde8dd4
commit
c9424361a6
@ -10,20 +10,15 @@ export class UserRepository extends Repository<User> {
|
||||
}
|
||||
|
||||
async getUsersIndiced(userIds: number[]): Promise<User[]> {
|
||||
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<User[]> {
|
||||
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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user