From 864546272c3d8aac402d5e5954aabe4e92e9d46a Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sun, 8 Mar 2026 14:30:04 +0330 Subject: [PATCH] watcher:bug --- src/modules/users/DTO/create-watcher.dto.ts | 4 ---- src/modules/users/services/users.service.ts | 4 ++-- src/modules/users/users.controller.ts | 5 +++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/modules/users/DTO/create-watcher.dto.ts b/src/modules/users/DTO/create-watcher.dto.ts index 5544ec8..0da06f2 100755 --- a/src/modules/users/DTO/create-watcher.dto.ts +++ b/src/modules/users/DTO/create-watcher.dto.ts @@ -25,10 +25,6 @@ export class CreateWatcherDto { @ApiProperty({ description: "Last name", example: "jamshidi" }) lastName: string; - @IsNotEmpty({ message: AuthMessage.BIRTH_DATE_NOT_EMPTY }) - @IsString({ message: AuthMessage.BIRTH_DATE_NOT_EMPTY }) - @ApiProperty({ description: "Birth date", example: "1403/01/01" }) - birthDate: string; @IsNotEmpty({ message: AuthMessage.NATIONAL_NOT_EMPTY }) @IsNumberString({ no_symbols: true }, { message: AuthMessage.NATIONAL_CODE_INCORRECT }) diff --git a/src/modules/users/services/users.service.ts b/src/modules/users/services/users.service.ts index c939fc7..a902b7d 100644 --- a/src/modules/users/services/users.service.ts +++ b/src/modules/users/services/users.service.ts @@ -183,12 +183,12 @@ export class UsersService { /*******************************/ async getWatchers(business: Business) { - return this.userRepository.find({ business: { id: business.id } }) + return this.userRepository.find({ business: { id: business.id }, role: { name: RoleEnum.WATCHER } }) } /*******************************/ async getWatcherById(id: string, business: Business) { - return this.userRepository.find({ id, business: { id: business.id } }) + return this.userRepository.find({ id, business: { id: business.id }, role: { name: RoleEnum.WATCHER } }) } /*******************************/ diff --git a/src/modules/users/users.controller.ts b/src/modules/users/users.controller.ts index 8149724..e7ca4a0 100644 --- a/src/modules/users/users.controller.ts +++ b/src/modules/users/users.controller.ts @@ -1,4 +1,4 @@ -import { Body, Controller, Delete, Get, Param, Post } from "@nestjs/common"; +import { Body, Controller, Delete, Get, Param, Post, UseInterceptors } from "@nestjs/common"; import { ApiOperation } from "@nestjs/swagger"; import { UsersService } from "./services/users.service"; @@ -7,10 +7,11 @@ import { UserDec } from "../../common/decorators/user.decorator"; import { CreateWatcherDto } from "./DTO/create-watcher.dto"; import { BusinessDec } from "../../common/decorators/business.decorator"; import { Business } from "../businesses/entities/business.entity"; +import { BusinessInterceptor } from "../../core/interceptors/business.interceptor"; @Controller("users") @AuthGuards() -// @UseInterceptors(BusinessInterceptor) +@UseInterceptors(BusinessInterceptor) export class UsersController { constructor(private readonly usersService: UsersService) { }