| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-02-15 20:59:55 |
| 4 | * @LastEditTime: 2025-04-27 18:16:37 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: |
| 7 | */ |
| 8 | import { ApiProperty } from '@nestjs/swagger'; |
| 9 | import { Expose, Type } from 'class-transformer'; |
| 10 | import { |
| 11 | IsArray, |
| 12 | IsEnum, |
| 13 | IsNotEmpty, |
| 14 | IsNumber, |
| 15 | IsOptional, |
| 16 | IsString, |
| 17 | } from 'class-validator'; |
| 18 | import { VideoUTypes } from '../comment'; |
| 19 | |
| 20 | export class AccessBackDto { |
| 21 | @Expose() |
| 22 | code: string; |
| 23 | |
| 24 | @Expose() |
| 25 | state: string; |
| 26 | } |
| 27 | |
| 28 | export class VideoInitDto { |
| 29 | @ApiProperty({ title: '文件名称(带格式)', required: true }) |
| 30 | @IsString({ message: '文件名称' }) |
| 31 | @Expose() |
| 32 | readonly fileName: string; |
| 33 | |
| 34 | @ApiProperty({ enum: VideoUTypes }) |
| 35 | @IsNotEmpty({ message: '文件类型不能为空' }) |
| 36 | @IsEnum(VideoUTypes) |
| 37 | @Type(() => Number) |
| 38 | @Expose() |
| 39 | readonly utype: VideoUTypes; |
| 40 | } |
| 41 | |
| 42 | export class ArchiveAddByUtokenQueryDto { |
| 43 | @ApiProperty({ title: '用户token', required: true }) |
| 44 | @IsString({ message: '用户token' }) |
| 45 | @Expose() |
| 46 | readonly accessToken: string; |
| 47 | |
| 48 | @ApiProperty({ title: '上传token', required: true }) |
| 49 | @IsString({ message: '上传token' }) |
| 50 | @Expose() |
| 51 | readonly uploadToken: string; |
| 52 | } |
| 53 | |
| 54 | export class ArchiveAddByUtokenBodyDto { |
| 55 | @ApiProperty({ title: '标题', required: true }) |
| 56 | @IsString({ message: '标题' }) |
| 57 | @Expose() |
| 58 | readonly title: string; |
| 59 | |
| 60 | @ApiProperty({ title: '封面url', required: false }) |
| 61 | @IsString({ message: '封面url' }) |
| 62 | @IsOptional() |
| 63 | @Expose() |
| 64 | readonly cover?: string; |
| 65 | |
| 66 | @ApiProperty({ title: '分区ID,由获取分区信息接口得到', required: true }) |
| 67 | @IsNumber({ allowNaN: false }, { message: '分区ID,由获取分区信息接口得到' }) |
| 68 | @Expose() |
| 69 | readonly tid: number; |
| 70 | |
| 71 | @ApiProperty({ |
| 72 | title: '是否允许转载 0-允许,1-不允许。默认0', |
| 73 | required: true, |
| 74 | }) |
| 75 | @IsNumber( |
| 76 | { allowNaN: false }, |
| 77 | { message: '是否允许转载 0-允许,1-不允许。默认0' }, |
| 78 | ) |
| 79 | @IsOptional() |
| 80 | @Expose() |
| 81 | readonly noReprint?: 0 | 1; |
| 82 | |
| 83 | @ApiProperty({ title: '描述', required: false }) |
| 84 | @IsString({ message: '描述' }) |
| 85 | @IsOptional() |
| 86 | @Expose() |
| 87 | readonly desc?: string; |
| 88 | |
| 89 | @ApiProperty({ title: '标签', required: false }) |
| 90 | @IsArray({ message: '标签必须是字符串数组' }) |
| 91 | @IsString({ each: true, message: '描述' }) |
| 92 | @Expose() |
| 93 | readonly tag: string[]; |
| 94 | |
| 95 | @ApiProperty({ |
| 96 | title: '1-原创,2-转载(转载时source必填)', |
| 97 | required: true, |
| 98 | }) |
| 99 | @IsNumber( |
| 100 | { allowNaN: false }, |
| 101 | { message: '1-原创,2-转载(转载时source必填)' }, |
| 102 | ) |
| 103 | @Expose() |
| 104 | readonly copyright: 1 | 2; |
| 105 | |
| 106 | @ApiProperty({ |
| 107 | title: '如果copyright为转载,则此字段表示转载来源', |
| 108 | required: false, |
| 109 | }) |
| 110 | @IsString({ message: '如果copyright为转载,则此字段表示转载来源' }) |
| 111 | @IsOptional() |
| 112 | @Expose() |
| 113 | readonly source?: string; |
| 114 | } |
| 115 |