watcher:bug
This commit is contained in:
@@ -25,10 +25,6 @@ export class CreateWatcherDto {
|
|||||||
@ApiProperty({ description: "Last name", example: "jamshidi" })
|
@ApiProperty({ description: "Last name", example: "jamshidi" })
|
||||||
lastName: string;
|
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 })
|
@IsNotEmpty({ message: AuthMessage.NATIONAL_NOT_EMPTY })
|
||||||
@IsNumberString({ no_symbols: true }, { message: AuthMessage.NATIONAL_CODE_INCORRECT })
|
@IsNumberString({ no_symbols: true }, { message: AuthMessage.NATIONAL_CODE_INCORRECT })
|
||||||
|
|||||||
@@ -183,12 +183,12 @@ export class UsersService {
|
|||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
async getWatchers(business: Business) {
|
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) {
|
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 } })
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|||||||
@@ -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 { ApiOperation } from "@nestjs/swagger";
|
||||||
|
|
||||||
import { UsersService } from "./services/users.service";
|
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 { CreateWatcherDto } from "./DTO/create-watcher.dto";
|
||||||
import { BusinessDec } from "../../common/decorators/business.decorator";
|
import { BusinessDec } from "../../common/decorators/business.decorator";
|
||||||
import { Business } from "../businesses/entities/business.entity";
|
import { Business } from "../businesses/entities/business.entity";
|
||||||
|
import { BusinessInterceptor } from "../../core/interceptors/business.interceptor";
|
||||||
|
|
||||||
@Controller("users")
|
@Controller("users")
|
||||||
@AuthGuards()
|
@AuthGuards()
|
||||||
// @UseInterceptors(BusinessInterceptor)
|
@UseInterceptors(BusinessInterceptor)
|
||||||
export class UsersController {
|
export class UsersController {
|
||||||
constructor(private readonly usersService: UsersService) { }
|
constructor(private readonly usersService: UsersService) { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user