Skip to content

Commit

Permalink
Fixed descriptions websocQuerySchema
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Ho authored and Vincent Ho committed Jan 18, 2025
1 parent 2250280 commit 2e6e60e
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions apps/api/src/schema/websoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,34 +76,33 @@ export const websocQuerySchema = z.object({
year: z
.string({ message: "Parameter 'year' is required " })
.length(4, { message: "Parameter 'year' must have length 4" })
.openapi({ description: "The academic year for course search", example: "2025" }),
.openapi({ description: "The year of the WebSoc section", example: "2025" }),
quarter: z.enum(terms).openapi({
description:
"The academic quarter 'Fall', 'Winter', 'Spring', 'Summer1', 'Summer10wk', or 'Summer2'",
description: "The quarter of the WebSoc section",
example: "Fall",
}),
ge: z
.enum(geCategories)
.optional()
.openapi({ description: "The general education category of the course", example: "GE-1A" })
.openapi({ description: "The GE category of the WebSoc section", example: "GE-1A" })
.transform((x) => (x === "ANY" ? undefined : x)),
department: z.string().optional().openapi({
description: "The department code of the course",
description: "The department of the WebSoc section",
example: "I&C SCI",
}),
courseTitle: z.string().optional().openapi({
description: "The course title of the course",
description: "The title of the WebSoc section's course",
example: "DATA STRC IMPL&ANLS",
}),
courseNumber: courseNumberSchema.optional().openapi({
description: "The course number(s) of the course",
description: "The course number of the WebSoc section's course",
example: "46",
}),
sectionCodes: z
.string()
.optional()
.openapi({
description: "The section code of the course",
description: "The section code of the WebSoc section",
example: "35530",
})
.transform((codes, ctx) => {
Expand Down Expand Up @@ -138,68 +137,70 @@ export const websocQuerySchema = z.object({
return parsedNums;
}),
instructorName: z.string().optional().openapi({
description: "The instructor name of the course",
description: "The instructor's name of the WebSoc section",
example: "Anteater, P.",
}),
days: daysSchema.optional().openapi({
description: "The days of the week for when the course meets",
description: "Selects WebSoc sections held on any of the given days",
example: "M,Tu,W,Th",
}),
building: z.string().optional().openapi({
description: "The building where the course is held",
description: "The building of the WebSoc section",
example: "ALP",
}),
room: z.string().optional().openapi({
description: "The room where the course is held",
description: "The room of the WebSoc section",
example: "1100",
}),
division: z
.enum(courseLevels)
.or(z.literal("ANY"))
.optional()
.openapi({
description:
"The type of course level of the course (e.g. Lower Division, Upper Division, or Graduate)",
description: "The division level of the WebSoc section",
example: "LowerDiv",
})
.transform((x) => (x === "ANY" ? undefined : x)),
sectionType: z
.union([z.enum(anyArray), z.enum(websocSectionTypes)])
.optional()
.openapi({
description: "The type of section of the course (e.g. Lecture, Discussion, Lab)",
description: "The section type of the WebSoc section, see [Registrar](https://reg.uci.edu/)",
example: "Lec",
})
.transform((x) => (x === "ANY" ? undefined : x)),
fullCourses: z
.enum(fullCoursesOptions)
.optional()
.openapi({
description: "The enrollment status of the course",
description: "Filter WebSoc sections by filled status",
example: "SkipFull",
})
.transform((x) => (x === "ANY" ? undefined : x)),
cancelledCourses: z.enum(cancelledCoursesOptions).optional().openapi({
description: "Include or exclude cancelled courses",
description:
"Filter courses based on their cancellation status, including only cancelled courses",
example: "Exclude",
}),
units: z.optional(z.literal("VAR").or(z.string())).openapi({
description: "The number of units for the courses",
description:
"Filter WebSoc sections by unit count. The value 'VAR' is used for courses with variable unit values, where the unit count can vary depending on the course section",
example: "4",
}),
startTime: timeSchema.optional().openapi({
description: "The course start time",
description: "Filters WebSoc sections for courses that start at or after this time",
example: "08:00",
}),
endTime: timeSchema.optional().openapi({
description: "The course end time",
description: "Filters WebSoc sections for courses that end at or before this time",
example: "17:00",
}),
excludeRestrictionCodes: z
.string()
.optional()
.openapi({
description: "Exclude courses with specific restriction codes",
description:
"Excludes WebSoc sections by comma-separated restriction codes, see [Restriction Codes](https://www.reg.uci.edu/enrollment/restrict_codes.html)",
example: "A,B,C",
})
.transform((codes, ctx) => {
Expand Down

0 comments on commit 2e6e60e

Please sign in to comment.