72 lines
2.2 KiB
TypeScript
72 lines
2.2 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
||
import { Type } from 'class-transformer';
|
||
import { IsString, IsNotEmpty, IsEnum, IsISO8601, IsOptional, IsBoolean, IsNumber } from 'class-validator';
|
||
import { RepairKind, RepairOrderStatus } from '@prisma/client';
|
||
|
||
export class CreateRepairOrderDto {
|
||
@ApiProperty({ description: 'Номер заявки' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
number: string;
|
||
|
||
@ApiProperty({ description: 'Дата заявки' })
|
||
@IsISO8601()
|
||
@Type(() => Date)
|
||
date: Date;
|
||
|
||
@ApiProperty({ description: 'Идентификатор оборудования' })
|
||
@IsString()
|
||
@IsNotEmpty()
|
||
equipmentId: string;
|
||
|
||
@ApiProperty({ enum: RepairKind, enumName: 'RepairKind', description: 'Вид ремонта' })
|
||
@IsEnum(RepairKind)
|
||
repairKind: RepairKind;
|
||
|
||
@ApiProperty({ enum: RepairOrderStatus, enumName: 'RepairOrderStatus', description: 'Статус заявки' })
|
||
@IsEnum(RepairOrderStatus)
|
||
status: RepairOrderStatus;
|
||
|
||
@ApiProperty({ description: 'Плановая дата начала' })
|
||
@IsISO8601()
|
||
@Type(() => Date)
|
||
plannedAt: Date;
|
||
|
||
@ApiProperty({ required: false, description: 'Фактическая дата начала' })
|
||
@IsISO8601()
|
||
@IsOptional()
|
||
@Type(() => Date)
|
||
startedAt?: Date;
|
||
|
||
@ApiProperty({ required: false, description: 'Фактическая дата завершения' })
|
||
@IsISO8601()
|
||
@IsOptional()
|
||
@Type(() => Date)
|
||
completedAt?: Date;
|
||
|
||
@ApiProperty({ required: false, description: 'Подрядная организация (если внешний ремонт)' })
|
||
@IsString()
|
||
@IsOptional()
|
||
contractor?: string;
|
||
|
||
@ApiProperty({ required: false, description: 'Наработка на момент ремонта, моточасов' })
|
||
@IsNumber()
|
||
@IsOptional()
|
||
@Type(() => Number)
|
||
engineHoursAtRepair?: number;
|
||
|
||
@ApiProperty({ required: false, description: 'Описание работ / дефекта' })
|
||
@IsString()
|
||
@IsOptional()
|
||
description?: string;
|
||
|
||
@ApiProperty({ required: false, description: 'Примечания' })
|
||
@IsString()
|
||
@IsOptional()
|
||
notes?: string;
|
||
|
||
@ApiProperty({ required: false, description: 'Согласовано/Не согласовано' })
|
||
@IsBoolean()
|
||
@IsOptional()
|
||
confirmed?: boolean;
|
||
} |