refactor: migrate backend framework from Express to NestJS
This commit is contained in:
63
src/serials/dto/index.ts
Normal file
63
src/serials/dto/index.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { IsString, IsNotEmpty, IsNumber, IsOptional, IsBoolean, Min, Max } from 'class-validator';
|
||||
|
||||
export class GenerateSerialDto {
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '企业名称不能为空' })
|
||||
companyName: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
@Max(100)
|
||||
quantity?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
validDays?: number;
|
||||
}
|
||||
|
||||
export class GenerateWithPrefixDto extends GenerateSerialDto {
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '自定义前缀不能为空' })
|
||||
serialPrefix: string;
|
||||
}
|
||||
|
||||
export class QRCodeDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
baseUrl?: string;
|
||||
}
|
||||
|
||||
export class UpdateSerialDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
companyName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
validUntil?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
export interface Serial {
|
||||
id: number;
|
||||
serial_number: string;
|
||||
company_name: string;
|
||||
valid_until: string | null;
|
||||
is_active: boolean;
|
||||
created_by: number | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface SerialListItem {
|
||||
serialNumber: string;
|
||||
companyName: string;
|
||||
validUntil: string | null;
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
createdBy?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user