File

src/titles/dtos/request/create-title.dto.ts

Description

Data Transfer Object for creating a new title (movie or series). This DTO defines the structure and validation rules for the title creation request.

Index

Properties

Properties

ageRating
Type : string
Decorators :
@ApiProperty({example: 'PG-13', description: 'age rating of the movie', required: true})
@IsString()
@IsNotEmpty()

Age rating (e.g., G, PG-13, R)

awards
Type : string | null
Decorators :
@ApiProperty({example: 'Best Picture', description: 'awards won by the movie'})
@IsString()

List of awards the title has received

countryId
Type : number
Decorators :
@ApiProperty({example: 1, description: 'id of country', required: true})
@IsNumber()
@IsNotEmpty()

ID of the country where the title was produced

coverUrl
Type : ConfirmUploadRequestDto | null
Decorators :
@ApiProperty({description: 'cover URL for the title', example: undefined, required: false, nullable: true, type: ConfirmUploadRequestDto})
@ValidateNested()
@Type(undefined)

URL of the cover image

durationMinutes
Type : number
Decorators :
@ApiProperty({example: 178, description: 'duration of the movie in minutes', type: Number, required: true})
@IsNumber()
@IsNotEmpty()

Duration of the title in minutes

genreIds
Type : number[] | null
Decorators :
@ApiProperty({example: undefined, description: 'genres ids'})
@IsArray()
@IsNumber({}, {each: true})

Array of genre IDs associated with the title

hasSubtitle
Type : boolean
Decorators :
@ApiProperty({example: true, description: 'indicates if the movie has subtitles', type: Boolean, required: true})
@IsBoolean()
@IsNotEmpty()

Indicates if the movie or series has subtitles

imdbRating
Type : number | null
Decorators :
@ApiProperty({example: 9.1, description: 'IMDB rating of the movie', type: Number})
@IsNumber()

IMDB rating score

imdbVotes
Type : number | null
Decorators :
@ApiProperty({example: 700000, description: 'IMDB votes of the movie', type: Number})
@IsNumber()

Number of IMDB votes received

isTop250
Type : boolean
Decorators :
@ApiProperty({example: false, description: 'indicates if the movie is part of top 250', type: Boolean, required: true})
@IsBoolean()
@IsNotEmpty()

Indicates if the title is listed in IMDB Top 250

languageId
Type : number
Decorators :
@ApiProperty({example: 1, description: 'movie language id', required: true})
@IsNumber()
@IsNotEmpty()

ID of the main spoken language in the title

releaseYear
Type : number
Decorators :
@ApiProperty({example: '2023-10-01', description: 'release date', required: true})
@IsNumber()
@IsNotEmpty()

Release year of the title

slug
Type : string
Decorators :
@ApiProperty({example: 'sample-movie', description: 'slug for url', required: true})
@IsString()
@IsNotEmpty()

Slug used in the URL (must be unique and SEO-friendly)

summary
Type : string | null
Decorators :
@ApiProperty({example: 'This is a sample movie summary.', description: 'summary of the movie'})
@IsString()

Short summary or description of the title

thumbnailUrl
Type : ConfirmUploadRequestDto | null
Decorators :
@ApiProperty({description: 'thmbnail URL for the title', example: undefined, required: false, nullable: true, type: ConfirmUploadRequestDto})
@ValidateNested()
@Type(undefined)

URL of the thumbnail image

titleEn
Type : string
Decorators :
@ApiProperty({example: 'Sample Movie', description: 'original title', required: true})
@IsString()
@IsNotEmpty()

Original (English) title of the movie or series

titleFa
Type : string
Decorators :
@ApiProperty({example: 'فیلم نمونه', description: 'persian title', required: true})
@IsString()
@IsNotEmpty()

Persian title of the movie or series

titlePeople
Type : CreateTitlePersonRequestDto[]
Decorators :
@ApiProperty({description: 'people that involve in title', type: undefined, required: true})
@IsArray()
@ValidateNested({each: true})
@Type(undefined)

IDs of people involved (e.g., actors, directors, writers)

top250Rank
Type : number | null
Decorators :
@ApiProperty({example: 100, description: 'rank of the movie in top 250', type: Number})
@IsNumber()

Rank position in IMDB Top 250 (if applicable)

trailerUrl
Type : ConfirmUploadRequestDto | null
Decorators :
@ApiProperty({description: 'trailer URL for the title', example: undefined, required: false, nullable: true, type: ConfirmUploadRequestDto})
@ValidateNested()
@Type(undefined)

URL of the trailer video

type
Type : TitleType
Decorators :
@ApiProperty({example: 'movie', description: 'type of the title (e.g., movie, series)', enum: TitleType, required: true})
@IsNotEmpty()
@IsEnum(TitleType)

Type of the title (movie or series)

Optional videoLinkIds
Type : number[]
Decorators :
@ApiProperty({example: undefined, description: 'IDs of video links associated with the title', type: undefined})
@IsArray()
@IsNumber({}, {each: true})

List of video link IDs associated with the title

import { ApiProperty } from '@nestjs/swagger';
import {
  IsArray,
  IsBoolean,
  IsEnum,
  IsNotEmpty,
  IsNumber,
  IsString,
  ValidateNested,
} from 'class-validator';
import { TitleType } from 'src/titles/enums/title-type.enum';
import { CreateTitlePersonRequestDto } from './create-title-person.dto';
import { Type } from 'class-transformer';
import { ConfirmUploadRequestDto } from 'src/upload-center/dtos/request/confirm-upload.dto';
import {
  BufferBucketNames,
  StreamBucketNames,
} from 'src/upload-center/enums/bucket-names.enum';

/**
 * Data Transfer Object for creating a new title (movie or series).
 * This DTO defines the structure and validation rules for the title creation request.
 */
export class CreateTitleDto {
  /** Persian title of the movie or series */
  @ApiProperty({
    example: 'فیلم نمونه',
    description: 'persian title',
    required: true,
  })
  @IsString()
  @IsNotEmpty()
  titleFa: string;

  /** Original (English) title of the movie or series */
  @ApiProperty({
    example: 'Sample Movie',
    description: 'original title',
    required: true,
  })
  @IsString()
  @IsNotEmpty()
  titleEn: string;

  /** Slug used in the URL (must be unique and SEO-friendly) */
  @ApiProperty({
    example: 'sample-movie',
    description: 'slug for url',
    required: true,
  })
  @IsString()
  @IsNotEmpty()
  slug: string;

  /** ID of the country where the title was produced */
  @ApiProperty({ example: 1, description: 'id of country', required: true })
  @IsNumber()
  @IsNotEmpty()
  countryId: number;

  /** Array of genre IDs associated with the title */
  @ApiProperty({ example: [1, 2], description: 'genres ids' })
  @IsArray()
  @IsNumber({}, { each: true })
  genreIds: number[] | null;

  /** ID of the main spoken language in the title */
  @ApiProperty({ example: 1, description: 'movie language id', required: true })
  @IsNumber()
  @IsNotEmpty()
  languageId: number;

  /** Release year of the title */
  @ApiProperty({
    example: '2023-10-01',
    description: 'release date',
    required: true,
  })
  @IsNumber()
  @IsNotEmpty()
  releaseYear: number;

  /** URL of the trailer video */
  @ApiProperty({
    description: 'trailer URL for the title',
    example: {
      bucket: StreamBucketNames.TRAILER,
      key: 'trailer-file-key',
    },
    required: false,
    nullable: true,
    type: ConfirmUploadRequestDto,
  })
  @ValidateNested()
  @Type(() => ConfirmUploadRequestDto)
  trailerUrl: ConfirmUploadRequestDto | null;

  /** URL of the cover image */
  @ApiProperty({
    description: 'cover URL for the title',
    example: {
      bucket: BufferBucketNames.COVER,
      key: 'cover-file-key',
    },
    required: false,
    nullable: true,
    type: ConfirmUploadRequestDto,
  })
  @ValidateNested()
  @Type(() => ConfirmUploadRequestDto)
  coverUrl: ConfirmUploadRequestDto | null;

  /** URL of the thumbnail image */
  @ApiProperty({
    description: 'thmbnail URL for the title',
    example: {
      bucket: BufferBucketNames.THUMBNAIL,
      key: 'thumbnail-file-key',
    },
    required: false,
    nullable: true,
    type: ConfirmUploadRequestDto,
  })
  @ValidateNested()
  @Type(() => ConfirmUploadRequestDto)
  thumbnailUrl: ConfirmUploadRequestDto | null;

  /** IDs of people involved (e.g., actors, directors, writers) */

  @ApiProperty({
    description: 'people that involve in title',
    type: [CreateTitlePersonRequestDto],
    required: true,
  })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => CreateTitlePersonRequestDto)
  titlePeople: CreateTitlePersonRequestDto[];

  /** Duration of the title in minutes */
  @ApiProperty({
    example: 178,
    description: 'duration of the movie in minutes',
    type: Number,
    required: true,
  })
  @IsNumber()
  @IsNotEmpty()
  durationMinutes: number;

  /** IMDB rating score */
  @ApiProperty({
    example: 9.1,
    description: 'IMDB rating of the movie',
    type: Number,
  })
  @IsNumber()
  imdbRating: number | null;

  /** Number of IMDB votes received */
  @ApiProperty({
    example: 700000,
    description: 'IMDB votes of the movie',
    type: Number,
  })
  @IsNumber()
  imdbVotes: number | null;

  /** Age rating (e.g., G, PG-13, R) */
  @ApiProperty({
    example: 'PG-13',
    description: 'age rating of the movie',
    required: true,
  })
  @IsString()
  @IsNotEmpty()
  ageRating: string;

  /** Short summary or description of the title */
  @ApiProperty({
    example: 'This is a sample movie summary.',
    description: 'summary of the movie',
  })
  @IsString()
  summary: string | null;

  /** Indicates if the movie or series has subtitles */
  @ApiProperty({
    example: true,
    description: 'indicates if the movie has subtitles',
    type: Boolean,
    required: true,
  })
  @IsBoolean()
  @IsNotEmpty()
  hasSubtitle: boolean;

  /** List of awards the title has received */
  @ApiProperty({
    example: 'Best Picture',
    description: 'awards won by the movie',
  })
  @IsString()
  awards: string | null;

  /** Indicates if the title is listed in IMDB Top 250 */
  @ApiProperty({
    example: false,
    description: 'indicates if the movie is part of top 250',
    type: Boolean,
    required: true,
  })
  @IsBoolean()
  @IsNotEmpty()
  isTop250: boolean;

  /** Rank position in IMDB Top 250 (if applicable) */
  @ApiProperty({
    example: 100,
    description: 'rank of the movie in top 250',
    type: Number,
  })
  @IsNumber()
  top250Rank: number | null;

  /** Type of the title (movie or series) */
  @ApiProperty({
    example: 'movie',
    description: 'type of the title (e.g., movie, series)',
    enum: TitleType,
    required: true,
  })
  @IsNotEmpty()
  @IsEnum(TitleType)
  type: TitleType;

  /** List of video link IDs associated with the title */
  @ApiProperty({
    example: [1, 2],
    description: 'IDs of video links associated with the title',
    type: [Number],
  })
  @IsArray()
  @IsNumber({}, { each: true })
  videoLinkIds?: number[];
}

results matching ""

    No results matching ""