Skip to content

Commit b7cf409

Browse files
committed
Revert "refactor(server): cleanup unused schemas"
This reverts commit ea74b1a.
1 parent ea74b1a commit b7cf409

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

packages/server/convex/http.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,78 @@ export const ZUpsertProgramWithRequirements = z.object({
139139
),
140140
});
141141

142+
export const ZUpsertRequirements = z.array(
143+
z.discriminatedUnion("type", [
144+
z.object({
145+
programId: z.pipe(
146+
z.string(),
147+
z.transform((val) => val as Id<"programs">),
148+
),
149+
isMajor: z.boolean(),
150+
description: z.optional(z.string()),
151+
type: z.literal("required"),
152+
courses: z.array(z.string()),
153+
}),
154+
z.object({
155+
programId: z.pipe(
156+
z.string(),
157+
z.transform((val) => val as Id<"programs">),
158+
),
159+
isMajor: z.boolean(),
160+
description: z.optional(z.string()),
161+
type: z.literal("alternative"),
162+
courses: z.array(z.string()),
163+
}),
164+
z.object({
165+
programId: z.pipe(
166+
z.string(),
167+
z.transform((val) => val as Id<"programs">),
168+
),
169+
isMajor: z.boolean(),
170+
description: z.optional(z.string()),
171+
type: z.literal("options"),
172+
courses: z.array(z.string()),
173+
courseLevels: z.array(
174+
z.object({
175+
program: z.string(),
176+
level: z.coerce.number(),
177+
}),
178+
),
179+
creditsRequired: z.number(),
180+
}),
181+
]),
182+
);
183+
184+
export const ZUpsertPrerequisites = z.array(
185+
z.discriminatedUnion("type", [
186+
z.object({
187+
courseId: z.pipe(
188+
z.string(),
189+
z.transform((val) => val as Id<"courses">),
190+
),
191+
type: z.literal("required"),
192+
courses: z.array(z.string()),
193+
}),
194+
z.object({
195+
courseId: z.pipe(
196+
z.string(),
197+
z.transform((val) => val as Id<"courses">),
198+
),
199+
type: z.literal("alternative"),
200+
courses: z.array(z.string()),
201+
}),
202+
z.object({
203+
courseId: z.pipe(
204+
z.string(),
205+
z.transform((val) => val as Id<"courses">),
206+
),
207+
type: z.literal("options"),
208+
courses: z.array(z.string()),
209+
creditsRequired: z.number(),
210+
}),
211+
]),
212+
);
213+
142214
export const ZUpsertCourseOfferings = z.array(
143215
z.object({
144216
courseCode: z.string(), // CSCI-UA 102

0 commit comments

Comments
 (0)