feat: improve attendance scheduling and API validation

This commit is contained in:
2026-07-14 23:12:14 +08:00
parent c75a08affe
commit e45da7f998
33 changed files with 869 additions and 297 deletions

View File

@@ -1,4 +1,5 @@
import { IsString, IsOptional, IsEnum, IsInt } from 'class-validator';
import { IsBoolean, IsIn, IsInt, IsOptional, IsString } from 'class-validator';
import { Transform, Type } from 'class-transformer';
export class CreateStudentDto {
@IsString()
@@ -82,6 +83,31 @@ export class UpdateStudentDto {
supervisor?: string;
@IsOptional()
@IsEnum(['active', 'graduated', 'withdrawn'])
@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;
}