add: relation

This commit is contained in:
ilham 2021-12-10 10:50:44 +07:00
parent 1e0be3dc48
commit 6360b92bf8

View File

@ -47,8 +47,13 @@ export class UsersController {
@Get('find-by-supperior') @Get('find-by-supperior')
async findBySuperrior(@Request() req, @Query('page') page: number) { async findBySuperrior(@Request() req, @Query('page') page: number) {
const [data, count] = await this.usersService.findBySuperrior(
req.user.userId,
page,
);
return { return {
data: await this.usersService.findBySuperrior(req.user.userId, page), data,
count,
statusCode: HttpStatus.OK, statusCode: HttpStatus.OK,
message: 'success', message: 'success',
}; };
@ -59,8 +64,10 @@ export class UsersController {
@Param('id', ParseUUIDPipe) id: string, @Param('id', ParseUUIDPipe) id: string,
@Query('page') page: number, @Query('page') page: number,
) { ) {
const [data, count] = await this.usersService.findByRoles(id, page);
return { return {
data: await this.usersService.findByRoles(id, page), data,
count,
statusCode: HttpStatus.OK, statusCode: HttpStatus.OK,
message: 'success', message: 'success',
}; };