| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-08-19 15:58:47 |
| 4 | * @LastEditTime: 2025-03-17 12:41:12 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: publish |
| 7 | */ |
| 8 | import { ApiProperty } from '@nestjs/swagger'; |
| 9 | import { Expose, Transform } from 'class-transformer'; |
| 10 | import { |
| 11 | ArrayMaxSize, |
| 12 | ArrayMinSize, |
| 13 | IsArray, |
| 14 | IsDate, |
| 15 | IsNumber, |
| 16 | IsOptional, |
| 17 | IsString, |
| 18 | } from 'class-validator'; |
| 19 | import { CreateWorkDataDto } from './workData.dto'; |
| 20 | |
| 21 | export class PubRecordIdDto { |
| 22 | @ApiProperty({ title: '发布记录ID', required: true }) |
| 23 | @IsNumber({ allowNaN: false }, { message: '发布记录ID' }) |
| 24 | @Expose() |
| 25 | readonly pubRecordId: number; |
| 26 | } |
| 27 | |
| 28 | export class VideoPulIdDto { |
| 29 | @ApiProperty({ title: 'ID', required: true }) |
| 30 | @IsNumber({ allowNaN: false }, { message: 'ID' }) |
| 31 | @Expose() |
| 32 | readonly id: number; |
| 33 | } |
| 34 | |
| 35 | export class VideoPulListDto { |
| 36 | @ApiProperty({ title: '发布记录ID', required: false }) |
| 37 | @IsNumber({ allowNaN: false }, { message: '发布记录ID' }) |
| 38 | @IsOptional() |
| 39 | @Expose() |
| 40 | readonly pubRecordId?: number; |
| 41 | |
| 42 | @ApiProperty({ title: '创建时间区间', required: false }) |
| 43 | @IsArray({ message: '创建时间区间必须是一个数组' }) |
| 44 | @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' }) |
| 45 | @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' }) |
| 46 | @IsDate({ each: true, message: '创建时间区间中的每个元素必须是有效的日期' }) |
| 47 | @IsOptional() |
| 48 | @Expose() |
| 49 | @Transform(({ value }) => value.map((v: string) => new Date(v))) |
| 50 | readonly time?: [Date, Date]; |
| 51 | |
| 52 | @ApiProperty({ title: '标题', required: false }) |
| 53 | @IsString({ message: '标题必须是一个字符串' }) |
| 54 | @IsOptional() |
| 55 | @Expose() |
| 56 | readonly title?: string; |
| 57 | } |
| 58 | |
| 59 | export class CreateVideoPulDto extends CreateWorkDataDto { |
| 60 | @ApiProperty({ title: '视频路径', required: false }) |
| 61 | @IsString({ message: '视频路径必须是一个字符串' }) |
| 62 | @IsOptional() |
| 63 | @Expose() |
| 64 | readonly videoPath: string; |
| 65 | } |
| 66 |