school-schedule-sync
Version:
Synchronization between JSON schedule and Google Calendar
34 lines • 1.14 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.scheduleSchema = void 0;
const zod_1 = require("zod");
const timeSchema = zod_1.z.object({
startTime: zod_1.z.string().regex(/^\d{2}:\d{2}$/),
length: zod_1.z.number(),
});
const eventSchema = timeSchema.extend({
name: zod_1.z.string(),
});
const lessonSchema = zod_1.z.string();
const sectionSchema = eventSchema;
const lessonCalendarSchema = zod_1.z.object({
name: zod_1.z.string(),
type: zod_1.z.literal('lessons'),
days: zod_1.z.array(zod_1.z.array(lessonSchema)).min(5).max(7),
lessonTimes: zod_1.z.array(timeSchema).min(5).max(7).optional(),
});
const sectionCalendarSchema = zod_1.z.object({
name: zod_1.z.string(),
type: zod_1.z.literal('sections'),
days: zod_1.z.array(zod_1.z.array(sectionSchema)).min(5).max(7),
});
exports.scheduleSchema = zod_1.z.object({
defaults: zod_1.z.object({
lessonTimes: zod_1.z.array(timeSchema).optional(),
}),
calendars: zod_1.z.array(zod_1.z.union([
lessonCalendarSchema,
sectionCalendarSchema,
])),
});
//# sourceMappingURL=types.js.map