38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import { IsString, IsNotEmpty, IsEnum, IsISO8601, IsOptional } from 'class-validator';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { EquipmentStatus } from '@prisma/client';
|
|
|
|
export class CreateEquipmentDto {
|
|
@ApiProperty({ description: 'Название оборудования' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
name: string;
|
|
|
|
@ApiProperty({ description: 'Заводской (серийный) номер' })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
serialNumber: string;
|
|
|
|
@ApiProperty({ description: 'Дата поверки', required: false })
|
|
@IsISO8601()
|
|
@Type(() => Date)
|
|
@IsOptional()
|
|
dateOfInspection?: Date | null;
|
|
|
|
@ApiProperty({ description: 'Дата изготовления', required: false })
|
|
@IsISO8601()
|
|
@Type(() => Date)
|
|
@IsOptional()
|
|
commissionedAt?: Date | null;
|
|
|
|
@ApiProperty({
|
|
enum: EquipmentStatus,
|
|
enumName: 'EquipmentStatus',
|
|
description: 'Текущий статус',
|
|
required: false
|
|
})
|
|
@IsEnum(EquipmentStatus)
|
|
@IsOptional()
|
|
status?: EquipmentStatus;
|
|
} |