92 lines
2.8 KiB
TypeScript
92 lines
2.8 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const classroomScheduleSchema = z
|
|
.object({
|
|
classrooms: z.array(z.record(z.string(), z.unknown())),
|
|
organizations: z.array(z.record(z.string(), z.unknown())),
|
|
// matrix: 教室 id → 日期 → 单条排课/租赁记录(对象,非数组)
|
|
matrix: z.record(z.string(), z.record(z.string(), z.record(z.string(), z.unknown()))),
|
|
summary: z.record(z.string(), z.record(z.string(), z.unknown())),
|
|
days: z.number().optional(),
|
|
})
|
|
.passthrough();
|
|
|
|
/** Dashboard 统计 */
|
|
export const dashboardStatsSchema = z
|
|
.object({
|
|
totalRooms: z.number(),
|
|
totalStudents: z.number(),
|
|
occupiedBeds: z.number(),
|
|
totalCapacity: z.number(),
|
|
occupancyRate: z.string(),
|
|
classroomCount: z.number(),
|
|
classroomOccupancyRate: z.string(),
|
|
todayAttendanceRate: z.string().optional(),
|
|
monthlyIncome: z.number(),
|
|
classCount: z.number(),
|
|
teacherCount: z.number(),
|
|
pendingDeposits: z.number(),
|
|
activeRentals: z.number(),
|
|
todayPresent: z.number(),
|
|
occupancyByBuilding: z.array(
|
|
z.object({ building: z.string(), count: z.string() }).passthrough(),
|
|
),
|
|
attendanceByStatus: z.record(z.string(), z.number()),
|
|
expenseByType: z.array(z.object({ type: z.string(), total: z.string() }).passthrough()),
|
|
attendanceTrend: z.array(z.object({ date: z.string(), rate: z.string() }).passthrough()),
|
|
incomeTrend: z.array(z.object({ month: z.string(), amount: z.number() }).passthrough()),
|
|
})
|
|
.passthrough();
|
|
|
|
export const roomRankingSchema = z.array(
|
|
z.object({ roomNumber: z.string(), total: z.string() }).passthrough(),
|
|
);
|
|
|
|
export const classAttendanceRankingSchema = z
|
|
.object({
|
|
top: z.array(
|
|
z
|
|
.object({ className: z.string(), present: z.number(), total: z.number(), rate: z.number() })
|
|
.passthrough(),
|
|
),
|
|
bottom: z.array(
|
|
z
|
|
.object({ className: z.string(), present: z.number(), total: z.number(), rate: z.number() })
|
|
.passthrough(),
|
|
),
|
|
})
|
|
.passthrough();
|
|
|
|
export const ganttRoomsSchema = z.array(
|
|
z
|
|
.object({
|
|
roomNumber: z.string(),
|
|
occupancies: z.array(
|
|
z.object({
|
|
studentName: z.string(),
|
|
studentId: z.union([z.string(), z.number()]).optional(),
|
|
checkInDate: z.string(),
|
|
checkOutDate: z.string().nullable(),
|
|
billingStartDate: z.string().optional(),
|
|
billingEndDate: z.string().nullable().optional(),
|
|
}),
|
|
),
|
|
}),
|
|
);
|
|
|
|
export const classroomOccupanciesSchema = z.array(
|
|
z
|
|
.object({ name: z.string(), building: z.string(), capacity: z.number(), occupancy: z.number() })
|
|
.passthrough(),
|
|
);
|
|
|
|
export const classroomUtilStatsSchema = z
|
|
.object({
|
|
totalClassrooms: z.number(),
|
|
inUseCount: z.number(),
|
|
utilizationRate: z.string(),
|
|
})
|
|
.passthrough();
|
|
|
|
/** 考勤元数据 */
|