File

src/video-link/dtos/request/create-video-link.dto.ts

Description

DTO for creating a video link This DTO is used to create a new video link with the specified URL, quality, and associated episode or title.

Index

Properties

Properties

Optional _onlyOne
Decorators :
@IsOnlyOneDefined('episodeId', 'titleId', {message: 'Exactly one of episodeId or titleId must be defined'})

Fake property to bind the validator This property is not used but is required for the validation to work

episodeId
Type : number
Decorators :
@ApiProperty({description: 'ID of the episode to which this video link belongs', type: 'number', required: true})
@IsOptional()
@IsInt()
@Type(undefined)

ID of the episode to which this video link belongs

quality
Type : VideoQuality
Decorators :
@ApiProperty({description: 'Quality of the video link', name: 'quality', enum: VideoQuality, required: true})
@IsEnum(VideoQuality)
@IsNotEmpty()

Quality of the video link

titleId
Type : number
Decorators :
@ApiProperty({description: 'ID of the episode to which this video link belongs', type: 'number', required: true})
@IsOptional()
@IsInt()
@Type(undefined)

ID of the episode to which this video link belongs

url
Type : ConfirmUploadRequestDto
Decorators :
@ApiProperty({description: 'URL of the video link', name: 'url', type: ConfirmUploadRequestDto, required: true})
@ValidateNested()
@Type(undefined)
@IsNotEmpty()

URL of the video link

import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsEnum, IsInt, IsNotEmpty, IsOptional, ValidateNested } from 'class-validator';
import { IsOnlyOneDefined } from 'src/common/validation/is-Only-One-defined.validation';
import { VideoQuality } from 'src/titles/enums/video-quality.enum';
import { ConfirmUploadRequestDto } from 'src/upload-center/dtos/request/confirm-upload.dto';

/**
 * DTO for creating a video link
 * This DTO is used to create a new video link with the specified URL, quality, and associated episode or title.
 */
export class CreateVideoLinkRequestDto {
  /**
   * URL of the video link
   * @type {ConfirmUploadRequestDto}
   */
  @ApiProperty({
    description: 'URL of the video link',
    name: 'url',
    type: ConfirmUploadRequestDto,
    required: true,
  })
  @ValidateNested()
  @Type(() => ConfirmUploadRequestDto)
  @IsNotEmpty()
  url: ConfirmUploadRequestDto;

  /**
   * Quality of the video link
   * @type {VideoQuality}
   */
  @ApiProperty({
    description: 'Quality of the video link',
    name: 'quality',
    enum: VideoQuality,
    required: true,
  })
  @IsEnum(VideoQuality)
  @IsNotEmpty()
  quality: VideoQuality;

  /**
   * ID of the episode to which this video link belongs
   * @type {number}
   */
  @ApiProperty({
    description: 'ID of the episode to which this video link belongs',
    type: 'number',
    required: true,
  })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  episodeId: number;

  /**
   * ID of the episode to which this video link belongs
   * @type {number}
   */
  @ApiProperty({
    description: 'ID of the episode to which this video link belongs',
    type: 'number',
    required: true,
  })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  titleId: number;

  /**
   * Fake property to bind the validator
   * This property is not used but is required for the validation to work
   */
  @IsOnlyOneDefined('episodeId', 'titleId', {
    message: 'Exactly one of episodeId or titleId must be defined',
  })
  _onlyOne?: unknown; // Fake property to bind the validator
}

results matching ""

    No results matching ""