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
124 lines
1.9 KiB
TypeScript
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;
|
|
}
|