From 1e0be3dc480930ed50628f5279e6ad4e8e030d77 Mon Sep 17 00:00:00 2001 From: ilham Date: Fri, 10 Dec 2021 01:37:39 +0700 Subject: [PATCH] add: relation --- src/product/product.service.ts | 1 + src/users/users.controller.ts | 2 +- src/users/users.service.ts | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/product/product.service.ts b/src/product/product.service.ts index 871a49b..ac5f9bb 100644 --- a/src/product/product.service.ts +++ b/src/product/product.service.ts @@ -46,6 +46,7 @@ export class ProductService { findAll(page) { return this.productRepository.findAndCount({ skip: page * 10, + relations: ['subCategories'], take: 10, order: { version: 'DESC', diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index f9f2387..dca7282 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -48,7 +48,7 @@ export class UsersController { @Get('find-by-supperior') async findBySuperrior(@Request() req, @Query('page') page: number) { return { - data: await this.usersService.findBySuperrior(req.user.id, page), + data: await this.usersService.findBySuperrior(req.user.userId, page), statusCode: HttpStatus.OK, message: 'success', }; diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 96365c7..e7ff8c6 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -114,7 +114,6 @@ export class UsersService { where: { superior: superriorId, }, - relations: ['roles'], order: { updatedAt: 'DESC', },