الملفات
back_end_oudelaa/src/modules/marketplace/dto/create-instrument.dto.ts
2026-04-20 15:12:16 +03:00

51 أسطر
746 B
TypeScript

import { Type } from 'class-transformer';
import {
ArrayMaxSize,
IsArray,
IsBoolean,
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
MaxLength,
Min,
} from 'class-validator';
export class CreateInstrumentDto {
@IsString()
@IsNotEmpty()
@MaxLength(120)
title!: string;
@IsOptional()
@IsString()
@MaxLength(2000)
description?: string;
@Type(() => Number)
@IsNumber()
@Min(0)
price!: number;
@IsOptional()
@IsString()
@MaxLength(8)
currency?: string;
@Type(() => Number)
@IsNumber()
@Min(0)
quantity!: number;
@IsOptional()
@IsArray()
@ArrayMaxSize(5)
@IsString({ each: true })
imageUrls?: string[];
@IsOptional()
@Type(() => Boolean)
@IsBoolean()
isActive?: boolean;
}