boilerplate-nestjs-api-crud/src/mysqlcompany/contract/dto/contract-create.dto.ts

31 lines
677 B
TypeScript

import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, IsNumber, IsOptional } from 'class-validator';
import { Staff } from 'src/mysqlcompany/staffs/entities/staff.entity';
export class ContractCreateDto {
// NOTE: Since the id is auto-inc, so no id for the creation
// id: number;
@ApiProperty({
description: 'Contract name',
})
@IsString()
@IsNotEmpty()
title: string;
@ApiProperty({
description: 'Contract details',
})
@IsString()
@IsOptional()
details: string;
@ApiProperty({
type: Staff,
name: 'departmentId',
description: 'Department ID',
required: false,
})
@IsOptional()
staff: Staff;
}