add find user by roles

This commit is contained in:
2021-12-08 11:06:26 +07:00
parent a418e74db5
commit 10984f65a5
4 changed files with 34 additions and 3 deletions

View File

@@ -38,6 +38,19 @@ export class UsersService {
});
}
findByRoles(relationId:string,page:number) {
return this.usersRepository.findAndCount({
skip: page * 10,
take: 10,
where:{
roles:relationId
},
order: {
updatedAt: 'DESC',
},
});
}
async findOne(id: string) {
const coa = await this.coaService.findByUser(id,coaType.WALLET);
try {
@@ -83,7 +96,7 @@ export class UsersService {
}
}
const result = await this.usersRepository.update(id, updateUserDto);
// const result = await this.usersRepository.update(id, updateUserDto);
return this.usersRepository.findOneOrFail(id);
}