74 lines
1.3 KiB
TypeScript
74 lines
1.3 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsIn,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
IsUrl,
|
|
MaxLength,
|
|
} from 'class-validator';
|
|
|
|
export class CreateVideoDto {
|
|
@IsOptional()
|
|
@IsString({ message: 'Id deve ser uma string' })
|
|
@MaxLength(244)
|
|
id?: string;
|
|
|
|
@IsOptional()
|
|
@IsArray({ message: 'Tags deve ser um array' })
|
|
tags?: string[];
|
|
|
|
@IsUrl()
|
|
@MaxLength(244)
|
|
url!: string;
|
|
|
|
@IsOptional()
|
|
@IsArray({ message: 'Categories deve ser um array' })
|
|
categories?: string[];
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(244)
|
|
title?: string;
|
|
|
|
@IsOptional()
|
|
@IsUrl()
|
|
@MaxLength(244)
|
|
thumbnail?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: 'Videoid deve ser uma string' })
|
|
@MaxLength(244)
|
|
videoid?: string;
|
|
|
|
@IsNumber()
|
|
@Type(() => Number)
|
|
duration!: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(244)
|
|
description?: string;
|
|
|
|
@IsString()
|
|
@IsIn(['automatic', 'low', 'medium', 'high'], {
|
|
message: 'Qualidade deve ser "low", "medium" ou "high"',
|
|
})
|
|
@MaxLength(244)
|
|
qualidade: string;
|
|
|
|
@IsOptional()
|
|
@IsUrl()
|
|
@MaxLength(244)
|
|
transcriptionUrl?: string;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber(
|
|
{ allowNaN: false, allowInfinity: false },
|
|
{ message: 'Timestamp deve ser um número' },
|
|
)
|
|
timestamp?: number;
|
|
}
|