Advertisement
nikolayneykov

Untitled

Nov 12th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   public async findUsers(options: any): Promise<UserDTO[]> {
  2.     const foundUsers: User[] = await this.usersRepository.find({
  3.       where: { username: Like(`%${options.keyword || ''}%`) },
  4.       order: { username: options.order === 'DESC' ? 'DESC' : 'ASC' },
  5.       take: options.take || 10,
  6.       skip: options.skip || 0,
  7.     });
  8.  
  9.     return foundUsers.map((u: User) => this.mapper.toUserDTO(u));
  10.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement