2025-06-12 14:13:07 +03:00

51 lines
940 B
TypeScript

import { ApiProperty } from '@nestjs/swagger';
import {
IsArray,
IsInt,
IsNotEmpty,
IsString,
IsUrl,
IsUUID,
Max,
Min,
} from 'class-validator';
import { Actor } from 'generated/prisma';
export class MovieDto {
@ApiProperty({
description: 'Название фильма',
example: 'Fight Club',
type: String,
})
@IsNotEmpty()
@IsString()
title: string;
@ApiProperty({
description: 'Год выпуска',
example: 1995,
type: Number,
})
@IsNotEmpty()
@IsInt()
@Min(1888)
@Max(new Date().getFullYear())
releaseYear: number;
@ApiProperty({
description: 'Список актеров',
example: ['1234', '5678'],
type: [String],
})
@IsArray()
@IsUUID('4', { each: true })
actorIds: Actor['id'][];
@ApiProperty({
description: 'URL постера',
example: 'https://storage.example.com/posters/12345.jpg',
})
@IsUrl()
imageUrl: string;
}