Files
gongxue-base/apps/server/src/bills/dto/bill.dto.ts

36 lines
726 B
TypeScript

import { ArrayNotEmpty, IsArray, IsIn, IsInt, IsNotEmpty, IsOptional, IsString, Matches, MaxLength } from 'class-validator';
export class GenerateBillsDto {
@IsString()
@Matches(/^\d{4}-\d{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 {
@IsString()
@IsNotEmpty()
@Matches(/\S/)
@MaxLength(300)
reason: string;
}
export class BatchUpdateBillStatusDto extends UpdateBillStatusDto {
@IsArray()
@ArrayNotEmpty()
@IsInt({ each: true })
ids: number[];
}