返回 AiToEarn
create-task.dto.ts
根目录 / project / aitoearn-electron / server / src / modules / task / dto / create-task.dto.ts
1 /*
2 * @Author: nevin
3 * @Date: 2025-03-01 19:27:26
4 * @LastEditTime: 2025-03-03 17:34:24
5 * @LastEditors: nevin
6 * @Description: 任务
7 */
8 import { ApiProperty } from '@nestjs/swagger';
9 import {
10 IsArray,
11 IsDate,
12 IsEnum,
13 IsNumber,
14 IsObject,
15 IsOptional,
16 IsString,
17 } from 'class-validator';
18 import {
19 TaskArticle,
20 TaskInteraction,
21 TaskProduct,
22 TaskPromotion,
23 TaskType,
24 TaskVideo,
25 } from '../../../db/schema/task.schema';
26 import { AccountType } from 'src/db/schema/account.schema';
27
28 export class CreateTaskDto {
29 @ApiProperty({ description: '任务标题' })
30 @IsString()
31 title: string;
32
33 @ApiProperty({ description: '任务描述' })
34 @IsString()
35 description: string;
36
37 @ApiProperty({ description: '任务类型', enum: TaskType })
38 @IsEnum(TaskType)
39 type: TaskType;
40
41 @ApiProperty({ description: '任务主体属性' })
42 @IsObject()
43 dataInfo:
44 | TaskVideo
45 | TaskPromotion
46 | TaskProduct
47 | TaskArticle
48 | TaskInteraction;
49
50 @ApiProperty({ description: '任务配图URL' })
51 @IsString()
52 @IsOptional()
53 imageUrl?: string;
54
55 @ApiProperty({ description: '附件地址列表' })
56 @IsArray()
57 fileList: string[];
58
59 @ApiProperty({ description: '是否需要挂购物车' })
60 @IsOptional()
61 requiresShoppingCart?: boolean;
62
63 @ApiProperty({ description: '收益' })
64 @IsNumber()
65 reward: number;
66
67 @ApiProperty({ description: '招募人数' })
68 @IsNumber()
69 maxRecruits: number;
70
71 @ApiProperty({ description: '任务截止时间' })
72 @IsDate()
73 deadline: Date;
74
75 @ApiProperty({ description: '支持的账号类型列表' })
76 @IsArray()
77 @IsEnum(AccountType, { each: true })
78 accountTypes: AccountType[];
79 }
80
80 lines TYPESCRIPT