Adiciona criacao de video
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import dayjs from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
|
||||
import { Transform } from 'class-transformer';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsArray,
|
||||
IsNumber,
|
||||
@@ -11,8 +8,6 @@ import {
|
||||
MaxLength,
|
||||
} from 'class-validator';
|
||||
|
||||
dayjs.extend(duration);
|
||||
|
||||
export class CreateVideoDto {
|
||||
@IsOptional()
|
||||
@IsString({ message: 'Id deve ser uma string' })
|
||||
@@ -46,34 +41,29 @@ export class CreateVideoDto {
|
||||
@MaxLength(244)
|
||||
videoid?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: 'Duration deve ser uma string' })
|
||||
@Transform(({ value }: { value: number }) => {
|
||||
const duration = dayjs.duration(value, 'seconds');
|
||||
|
||||
return duration.format('HH:mm:ss');
|
||||
})
|
||||
duration?: string;
|
||||
@IsNumber()
|
||||
@Type(() => Number)
|
||||
duration!: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(244)
|
||||
description?: string;
|
||||
|
||||
@IsString()
|
||||
@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' },
|
||||
)
|
||||
@Transform(({ value }: { value: number }) => {
|
||||
const duration = dayjs(value * 1000);
|
||||
|
||||
return duration.format('DD/MM/YYYY HH:mm:ss');
|
||||
})
|
||||
timestamp?: string;
|
||||
timestamp?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user