| 1 | import { |
| 2 | IsString, |
| 3 | IsNotEmpty, |
| 4 | IsOptional, |
| 5 | IsDateString, |
| 6 | IsInt, |
| 7 | Min, |
| 8 | MaxLength, |
| 9 | } from 'class-validator'; |
| 10 | |
| 11 | export class CreateEventDto { |
| 12 | @IsString({ message: 'Title must be a string' }) |
| 13 | @IsNotEmpty({ message: 'Title is required' }) |
| 14 | @MaxLength(255) |
| 15 | title: string; |
| 16 | |
| 17 | @IsString({ message: 'Description must be a string' }) |
| 18 | @IsOptional() |
| 19 | description?: string; |
| 20 | |
| 21 | @IsDateString({}, { message: 'Date must be a valid date string' }) |
| 22 | @IsNotEmpty({ message: 'Date is required' }) |
| 23 | date: string; |
| 24 | |
| 25 | @IsString({ message: 'Location must be a string' }) |
| 26 | @IsNotEmpty({ message: 'Location is required' }) |
| 27 | @MaxLength(255) |
| 28 | location: string; |
| 29 | |
| 30 | @IsInt() |
| 31 | @Min(1, { message: 'Capacity must be at least 1' }) |
| 32 | capacity: number; |
| 33 | |
| 34 | @IsInt() |
| 35 | @Min(0, { message: 'Price must be at least 0' }) |
| 36 | @IsOptional() |
| 37 | price: number; |
| 38 | } |