Files
gongxue-base/apps/server/src/students/dto/student.dto.ts
wangziqi 375c7ec60b feat: refine admin forms, attendance and finance workflows
Squash merge PR #23.

Included changes:
- complete occupancy check-in required fields/default payload
- improve responsive admin management pages
- fix attendance edge cases and attendance period config
- refine wallet/finance-related workflow handling

Checks:
- npm run typecheck -w apps/admin
- npm run typecheck -w apps/server
2026-07-18 12:54:10 +00:00

124 lines
1.9 KiB
TypeScript

import { IsBoolean, IsIn, IsInt, IsOptional, IsString } from 'class-validator';
import { Transform, Type } from 'class-transformer';
export class CreateStudentDto {
@IsString()
name: string;
@IsOptional()
@IsString()
studentNo?: string;
@IsOptional()
@IsString()
phone?: string;
@IsOptional()
@IsString()
idNumber?: string;
@IsOptional()
@IsString()
gender?: string;
@IsOptional()
@IsString()
ethnicity?: string;
@IsOptional()
@IsString()
emergencyContact?: string;
@IsOptional()
@IsString()
emergencyPhone?: string;
@IsInt()
organizationId: number;
@IsOptional()
@IsString()
supervisor?: string;
}
export class UpdateStudentDto {
@IsOptional()
@IsString()
name?: string;
@IsOptional()
@IsString()
studentNo?: string;
@IsOptional()
@IsString()
phone?: string;
@IsOptional()
@IsString()
idNumber?: string;
@IsOptional()
@IsString()
gender?: string;
@IsOptional()
@IsString()
ethnicity?: string;
@IsOptional()
@IsString()
emergencyContact?: string;
@IsOptional()
@IsString()
emergencyPhone?: string;
@IsOptional()
@IsInt()
organizationId?: number;
@IsOptional()
@IsString()
supervisor?: string;
@IsOptional()
@IsIn(['active', 'graduated', 'withdrawn'])
status?: string;
}
export class QueryStudentDto {
@IsOptional()
@IsString()
name?: string;
@IsOptional()
@IsIn(['active', 'graduated', 'withdrawn', 'archived'])
status?: string;
@IsOptional()
@Transform(({ value }) => {
if (typeof value === 'boolean') return value;
if (value === 'true' || value === '1') return true;
if (value === 'false' || value === '0') return false;
return value;
})
@IsBoolean()
includeArchived?: boolean;
@IsOptional()
@Type(() => Number)
@IsInt()
organizationId?: number;
@IsOptional()
@Type(() => Number)
@IsInt()
classId?: number;
@IsOptional()
@Type(() => Number)
@IsInt()
teacherId?: number;
}