| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-06-17 20:12:31 |
| 4 | * @LastEditTime: 2025-03-03 19:00:31 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: |
| 7 | */ |
| 8 | import { ApiProperty } from '@nestjs/swagger'; |
| 9 | import { Expose, Type } from 'class-transformer'; |
| 10 | import { IsEnum, IsOptional, IsString } from 'class-validator'; |
| 11 | import { Banner, BannerTag } from 'src/db/schema/banner.schema'; |
| 12 | import { ONOFF } from 'src/global/enum/all.enum'; |
| 13 | |
| 14 | export class ActionBannerDto implements Partial<Banner> { |
| 15 | @ApiProperty({ required: false }) |
| 16 | @IsString({ message: '数据ID' }) |
| 17 | @IsOptional() |
| 18 | @Expose() |
| 19 | readonly dataId?: string; |
| 20 | |
| 21 | @ApiProperty({ required: false }) |
| 22 | @IsString({ message: '描述' }) |
| 23 | @IsOptional() |
| 24 | @Expose() |
| 25 | readonly desc?: string; |
| 26 | |
| 27 | @ApiProperty({ required: false }) |
| 28 | @IsString({ message: '链接' }) |
| 29 | @IsOptional() |
| 30 | @Expose() |
| 31 | readonly url?: string; |
| 32 | |
| 33 | @ApiProperty({ title: '图片链接', required: true }) |
| 34 | @IsString({ message: '图片链接' }) |
| 35 | @Expose() |
| 36 | readonly imgUrl: string; |
| 37 | |
| 38 | @ApiProperty({ title: '标识', required: true }) |
| 39 | @IsEnum(BannerTag, { message: '标识' }) |
| 40 | @Expose() |
| 41 | readonly tag: BannerTag; |
| 42 | } |
| 43 | |
| 44 | export class BannerIdDto { |
| 45 | @ApiProperty({ title: 'ID', required: true }) |
| 46 | @IsString({ message: 'ID' }) |
| 47 | @Expose() |
| 48 | id: string; |
| 49 | } |
| 50 | |
| 51 | export class GetBannerListDto { |
| 52 | @ApiProperty({ title: 'ID', required: false }) |
| 53 | @IsString({ message: 'ID' }) |
| 54 | @IsOptional() |
| 55 | @Expose() |
| 56 | readonly id?: string; |
| 57 | } |
| 58 | |
| 59 | export class AppGetBannerListDto { |
| 60 | @ApiProperty({ title: 'tag', required: false }) |
| 61 | @IsEnum(BannerTag, { message: 'tag' }) |
| 62 | @IsOptional() |
| 63 | @Expose() |
| 64 | readonly tag?: BannerTag; |
| 65 | } |
| 66 | |
| 67 | export class UpdateBannerPublishDto { |
| 68 | @ApiProperty({ title: '是否发布', required: true }) |
| 69 | @IsEnum(ONOFF, { message: '是否发布' }) |
| 70 | @Type(() => Number) |
| 71 | @Expose() |
| 72 | readonly isPublish: ONOFF; |
| 73 | } |
| 74 |