add: paging in user and relation when get in user
This commit is contained in:
@@ -28,14 +28,25 @@ export class UsersService {
|
||||
return this.usersRepository.findOneOrFail(result.identifiers[0].id);
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.usersRepository.findAndCount();
|
||||
findAll(page:number) {
|
||||
return this.usersRepository.findAndCount({
|
||||
skip: page * 10,
|
||||
take: 10,
|
||||
order: {
|
||||
version: 'DESC',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
const coa = await this.coaService.findByUser(id,coaType.WALLET);
|
||||
try {
|
||||
const userData = await this.usersRepository.findOneOrFail(id);
|
||||
const userData = await this.usersRepository.findOneOrFail({
|
||||
where: {
|
||||
id: id
|
||||
},
|
||||
relations:["roles","superior"]
|
||||
});
|
||||
return {
|
||||
...userData,
|
||||
wallet:coa.amount,
|
||||
|
||||
Reference in New Issue
Block a user