add filter in user
This commit is contained in:
		| @@ -118,7 +118,7 @@ export class UsersService { | ||||
|     return userData; | ||||
|   } | ||||
|  | ||||
|   async findAll(page: number, id: string) { | ||||
|   async findAll(page: number, id: string, superior: string, type: string) { | ||||
|     const baseQuery = this.usersRepository | ||||
|       .createQueryBuilder('user') | ||||
|       .where('user.id != :id', { | ||||
| @@ -148,6 +148,20 @@ export class UsersService { | ||||
|         'coa.amount', | ||||
|       ]); | ||||
|  | ||||
|     if(superior){ | ||||
|       baseQuery.where('user.superior = :id_supperior',{ | ||||
|         id_supperior:superior | ||||
|       }) | ||||
|     } | ||||
|  | ||||
|     if(type){ | ||||
|       if(type == 'partner'){ | ||||
|         baseQuery.where('user.partner_id is not null') | ||||
|       } else { | ||||
|         baseQuery.where('user.partner_id is null') | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     const data = await baseQuery | ||||
|       .orderBy('user.createdAt', 'DESC') | ||||
|       .skip(page * 10) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user