返回 AiToEarn
userWalletRecord.dto.ts
根目录 / project / aitoearn-electron / server / src / modules / finance / dto / userWalletRecord.dto.ts
1 /*
2 * @Author: nevin
3 * @Date: 2025-02-15 20:59:55
4 * @LastEditTime: 2025-03-24 21:52:23
5 * @LastEditors: nevin
6 * @Description:
7 */
8 import { ApiProperty } from '@nestjs/swagger';
9 import { Expose } from 'class-transformer';
10 import {
11 ArrayMaxSize,
12 ArrayMinSize,
13 IsArray,
14 IsDateString,
15 IsEnum,
16 IsNumber,
17 IsOptional,
18 IsString,
19 } from 'class-validator';
20 import { PagerDto } from 'src/common/dto/pager.dto';
21 import {
22 UserWalletRecordStatus,
23 UserWalletRecordType,
24 } from 'src/db/schema/userWalletRecord.shema';
25
26 export class GetUserWalletRecordListDto extends PagerDto {
27 @ApiProperty({ title: '创建时间区间', required: false })
28 @IsArray({ message: '创建时间区间必须是一个数组' })
29 @ArrayMinSize(2, { message: '创建时间区间必须包含两个日期' })
30 @ArrayMaxSize(2, { message: '创建时间区间必须包含两个日期' })
31 // @IsDate({ each: true, message: '创建时间区间中的每个元素必须是有效的日期' })
32 @IsDateString({}, { each: true })
33 @IsOptional()
34 @Expose()
35 readonly time?: [Date, Date];
36
37 @ApiProperty({ enum: UserWalletRecordType })
38 @IsEnum(UserWalletRecordType)
39 @IsOptional()
40 @Expose()
41 type?: UserWalletRecordType;
42 }
43
44 export class GetUserWalletRecordListByAdminDto extends PagerDto {
45 // 起始时间
46 @ApiProperty({ type: [String] })
47 @Expose()
48 time?: [string, string];
49
50 @ApiProperty({ enum: UserWalletRecordType })
51 @Expose()
52 type?: UserWalletRecordType;
53
54 @ApiProperty({ enum: UserWalletRecordStatus })
55 @Expose()
56 status?: UserWalletRecordStatus;
57
58 @ApiProperty({ type: String })
59 @Expose()
60 userId?: string;
61 }
62
63 export class UpUserWalletRecordPul {
64 @IsString({
65 message: '说明',
66 })
67 @IsOptional()
68 @Expose()
69 des?: string;
70
71 @IsString({
72 message: '反馈截图',
73 })
74 @IsOptional()
75 @Expose()
76 imgUrl?: string; // 反馈截图
77 }
78
79 export class CreateUserWalletRecordDto {
80 @ApiProperty({ type: String, description: '钱包账户id', required: true })
81 @IsString({
82 message: '钱包账户id必须为字符串',
83 })
84 @Expose()
85 walletAccountId: string;
86
87 @ApiProperty({ type: Number, description: '金额', required: true })
88 @IsNumber(
89 {
90 allowNaN: false,
91 },
92 { message: '金额必须为数字' },
93 )
94 @Expose()
95 balance: number;
96
97 @ApiProperty({ enum: UserWalletRecordStatus })
98 status?: UserWalletRecordStatus;
99 }
100
100 lines TYPESCRIPT