refactor: 前端应用骨架迁移至 zustand 并统一路由权限壳
This commit is contained in:
80
apps/admin/src/api/schemas/attendance.ts
Normal file
80
apps/admin/src/api/schemas/attendance.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const attendanceRecordSchema = z
|
||||
.object({
|
||||
id: z.number(),
|
||||
studentId: z.number(),
|
||||
classId: z.number().nullable(),
|
||||
attendanceDate: z.string(),
|
||||
session: z.string(),
|
||||
status: z.string(),
|
||||
remark: z.string().nullable(),
|
||||
createdAt: z.string(),
|
||||
student: z
|
||||
.object({ id: z.number(), name: z.string(), studentNo: z.string().nullable().optional() })
|
||||
.passthrough(),
|
||||
class: z.object({ id: z.number(), name: z.string() }).passthrough().nullable(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const attendanceRecordsResponseSchema = z
|
||||
.object({ list: z.array(attendanceRecordSchema), total: z.number() })
|
||||
.passthrough();
|
||||
|
||||
export const attendanceSummarySchema = z
|
||||
.object({
|
||||
total: z.number(),
|
||||
present: z.number(),
|
||||
late: z.number(),
|
||||
absent: z.number(),
|
||||
leave: z.number(),
|
||||
pending: z.number(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const dingTalkSyncStatusSchema = z
|
||||
.object({
|
||||
lastPulledAt: z.string().nullable(),
|
||||
action: z.string().nullable(),
|
||||
username: z.string().nullable(),
|
||||
detail: z.string().nullable(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/** 学生档案聚合 */
|
||||
|
||||
export const attendanceClassOptionSchema = z
|
||||
.object({ classId: z.number(), className: z.string() })
|
||||
.passthrough();
|
||||
|
||||
export const attendanceClassOptionsSchema = z.array(attendanceClassOptionSchema);
|
||||
|
||||
export const attendanceAlertSchema = z
|
||||
.object({ id: z.number(), type: z.string(), message: z.string() })
|
||||
.passthrough();
|
||||
|
||||
export const attendanceAlertsSchema = z.array(attendanceAlertSchema);
|
||||
|
||||
export const attendancePeriodSchema = z
|
||||
.object({
|
||||
periodKey: z.string(),
|
||||
label: z.string(),
|
||||
startTime: z.string(),
|
||||
endTime: z.string(),
|
||||
sortOrder: z.number(),
|
||||
enabled: z.boolean(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const attendancePeriodsSchema = z.array(attendancePeriodSchema);
|
||||
|
||||
export const attendanceScheduleOptionSchema = z
|
||||
.object({
|
||||
id: z.number(),
|
||||
subject: z.string(),
|
||||
startTime: z.string(),
|
||||
endTime: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const attendanceScheduleOptionsSchema = z.array(attendanceScheduleOptionSchema);
|
||||
Reference in New Issue
Block a user