File

src/user/dto/user.dto.ts

Index

Properties

Properties

clientId
Type : number
Decorators :
@ApiProperty()
userId
Type : number
Decorators :
@ApiProperty()
import { ApiProperty } from '@nestjs/swagger';
import {
  IsEmail,
  IsNotEmpty,
  IsOptional,
  Length,
  MaxLength,
} from 'class-validator';

export class UserCreateDTO {
  @IsNotEmpty()
  @ApiProperty({ example: 'User Test', required: true })
  name: string;

  @IsNotEmpty()
  @ApiProperty({ example: 'test', required: true })
  username: string;

  @IsNotEmpty()
  @IsEmail()
  @ApiProperty({ example: '[email protected]', required: true })
  email: string;

  @Length(11, 11, { message: 'invalid_cpf_length' })
  @IsOptional()
  @ApiProperty({ example: 'CPF' })
  cpf: string;

  @ApiProperty({ example: 'Cargo do usuário' })
  userRole: string;

  @ApiProperty({ example: 'Telefone 1' })
  telephone1: string;

  @ApiProperty({ example: 'Telefone 2' })
  telephone2: string;

  @ApiProperty({ example: 'FAX' })
  fax: string;

  @ApiProperty({ example: 'Observação' })
  observation: string;

  @ApiProperty({ example: 123, type: 'int4' })
  ramal1: number;

  @ApiProperty({ example: 123, type: 'int4' })
  ramal2: number;

  @ApiProperty({ example: 100, type: 'int4', required: false })
  jobPositionId?: number;
}

export class UserUpdateDTO {
  @IsNotEmpty()
  @ApiProperty()
  name: string;

  @IsNotEmpty()
  @ApiProperty()
  email: string;

  @Length(11, 11, { message: 'invalid_cpf_length' })
  @IsOptional()
  @ApiProperty({ example: 'CPF' })
  cpf: string;

  @ApiProperty({ example: 'Cargo do usuário' })
  userRole: string;

  @ApiProperty({ example: 'Telefone 1' })
  telephone1: string;

  @ApiProperty({ example: 'Telefone 2' })
  telephone2: string;

  @ApiProperty({ example: 'FAX' })
  fax: string;

  @ApiProperty({ example: 'Observação' })
  observation: string;

  @ApiProperty({ example: 123, type: 'int4' })
  ramal1: number;

  @ApiProperty({ example: 123, type: 'int4' })
  ramal2: number;

  @ApiProperty({ example: 100, type: 'int4', required: false })
  jobPositionId?: number;
}

export class PaginateUserQueryDto {
  @ApiProperty({ required: false })
  name: string;

  @ApiProperty({ required: false })
  email: string;

  @ApiProperty({ default: false })
  onlyActive: string;

  @ApiProperty({ default: 0 })
  page: number;

  @ApiProperty({ default: 10 })
  size: number;
}

export class AddUserClientDTO {
  @ApiProperty()
  clientId: number;

  @ApiProperty()
  userId: number;
}

results matching ""

    No results matching ""