Files
gongxue-base/apps/server/src/bills/dto/bill.dto.ts
wangziqi f50301148d fix(correctness): 并发/事务/实体/时区/状态一致性修复
由 OCR(open-codereview.ai,deepseek-v4-flash)审查驱动修复:
- wallets 原子扣款防 double-spend;refund 条件更新幂等;findTransactions 分页
- financial/imports/occupancies/attendance 事务与 advisory lock;重复生成/提交幂等
- 矛盾校验器、日期区间、实体双映射/DECIMAL/nullable、时区统一(china-time)
- rbac-seed 防重激活、exam 权限恢复、状态一致性、路由顺序、N+1/IN 分块等性能项

Reviewed-by: OCR (open-codereview.ai)
2026-08-09 21:29:54 +08:00

60 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
ArrayMaxSize,
IsArray,
IsIn,
IsInt,
IsNotEmpty,
IsOptional,
IsString,
Matches,
MaxLength,
} from 'class-validator';
export class GenerateBillsDto {
@IsOptional()
@IsString()
@Matches(/^[\w-]{8,64}$/)
operationId?: string;
@IsString()
@Matches(/^\d{4}-(0[1-9]|1[0-2])$/)
billingMonth: string;
@IsOptional()
@IsString()
periodStart?: string;
@IsOptional()
@IsString()
periodEnd?: string;
}
export class UpdateBillStatusDto {
@IsIn(['unpaid', 'partially_paid', 'paid'])
status: 'unpaid' | 'partially_paid' | 'paid';
}
export class CancelBillDto {
@IsOptional()
@IsString()
@Matches(/^[\w-]{8,64}$/)
operationId?: string;
@IsString()
@IsNotEmpty()
@Matches(/\S/)
@MaxLength(300)
reason: string;
}
/** 批量确认账单请求体ids 校验为整数数组且最多 500 条。 */
export class BatchIdsBodyDto {
@IsArray()
@IsInt({ each: true })
@ArrayMaxSize(500)
ids: number[];
@IsIn(['unpaid', 'partially_paid', 'paid'])
status: 'unpaid' | 'partially_paid' | 'paid';
}