Init repo
This commit is contained in:
59
src/videos/dto/create-video-dto.ts
Normal file
59
src/videos/dto/create-video-dto.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import {
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsISO8601,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUrl,
|
||||
MaxLength,
|
||||
} from 'class-validator';
|
||||
import { EVideoSituation } from '../../../generated/prisma';
|
||||
|
||||
export class CreateVideoDto {
|
||||
@IsUrl()
|
||||
@MaxLength(244)
|
||||
url!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(EVideoSituation)
|
||||
situation?: EVideoSituation;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(244)
|
||||
error_message?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
clips_quantity?: number;
|
||||
|
||||
@IsOptional()
|
||||
times?: unknown;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(244)
|
||||
title?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(244)
|
||||
filename?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(244)
|
||||
videoid?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsISO8601()
|
||||
datetime_download?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsISO8601()
|
||||
datetime_convert?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsISO8601()
|
||||
datetime_posted?: string;
|
||||
}
|
||||
29
src/videos/dto/paginated.dto.ts
Normal file
29
src/videos/dto/paginated.dto.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsInt, IsOptional, Max, Min } from 'class-validator';
|
||||
|
||||
export class PaginatedQueryDto {
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
page: number = 1;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(100)
|
||||
perPage: number = 20;
|
||||
}
|
||||
|
||||
export type PaginatedResponse<T> = {
|
||||
content: T[];
|
||||
pagination: {
|
||||
page: number;
|
||||
perPage: number;
|
||||
total: number;
|
||||
totalPages: number;
|
||||
hasNext: boolean;
|
||||
hasPrev: boolean;
|
||||
};
|
||||
};
|
||||
12
src/videos/dto/video-response.dto.ts
Normal file
12
src/videos/dto/video-response.dto.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { EVideoSituation } from 'generated/prisma';
|
||||
|
||||
export interface VideoResponseDto {
|
||||
id: number;
|
||||
title: string | null;
|
||||
url: string;
|
||||
situation: EVideoSituation;
|
||||
clips_quantity: number;
|
||||
videoid: string;
|
||||
filename: string;
|
||||
datetime_download: Date | string;
|
||||
}
|
||||
Reference in New Issue
Block a user