feat: add Attendance module with batch, summary, calendar, and dingtalk endpoints
This commit is contained in:
85
apps/server/src/attendance/dto/attendance.dto.ts
Normal file
85
apps/server/src/attendance/dto/attendance.dto.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import {
|
||||
IsArray,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsInt,
|
||||
IsDateString,
|
||||
IsIn,
|
||||
ValidateNested,
|
||||
IsNotEmpty,
|
||||
} from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class AttendanceRecordItem {
|
||||
@IsInt()
|
||||
@IsNotEmpty()
|
||||
studentId: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
classId?: number;
|
||||
|
||||
@IsDateString()
|
||||
@IsNotEmpty()
|
||||
attendanceDate: string;
|
||||
|
||||
@IsString()
|
||||
@IsIn(['morning', 'afternoon', 'evening'])
|
||||
@IsNotEmpty()
|
||||
session: string;
|
||||
|
||||
@IsString()
|
||||
@IsIn(['present', 'late', 'absent', 'leave'])
|
||||
@IsNotEmpty()
|
||||
status: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export class BatchCreateAttendanceDto {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AttendanceRecordItem)
|
||||
records: AttendanceRecordItem[];
|
||||
}
|
||||
|
||||
export class AttendanceSummaryQueryDto {
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Type(() => Number)
|
||||
classId?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
dateFrom?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
dateTo?: string;
|
||||
}
|
||||
|
||||
export class AttendanceCalendarQueryDto {
|
||||
@IsInt()
|
||||
@Type(() => Number)
|
||||
@IsNotEmpty()
|
||||
classId: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
weekStart?: string;
|
||||
}
|
||||
|
||||
export class QueryDingRawDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(['未处理', '已匹配', '待匹配'])
|
||||
matchStatus?: string;
|
||||
}
|
||||
|
||||
export class MatchDingRecordDto {
|
||||
@IsInt()
|
||||
@IsNotEmpty()
|
||||
studentId: number;
|
||||
}
|
||||
Reference in New Issue
Block a user