Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const DEPARTMENTS = {
"21H": "History",
"21L": "Literature",
"21M": "Music and Theater Arts",
"21T": "Theater Arts",
22: "Nuclear Science and Engineering",
24: "Linguistics and Philosophy",
CC: "Concourse",
Expand Down
9 changes: 8 additions & 1 deletion src/hooks/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ type QueryParamValidators<ReqParams> = {
[k in keyof Required<ReqParams>]: (v: string[]) => ReqParams[k]
}

// "21T" (Theater Arts) isn't in the published mit-learn-api-axios DepartmentEnum yet,
// so it's added here and cast to the enum value type. Remove once the openapi release ships.
const PATCHED_DEPARTMENT_VALUES = [
...Object.values(DepartmentEnum),
"21T"
] as (typeof DepartmentEnum)[keyof typeof DepartmentEnum][]

const resourceSearchValidators: QueryParamValidators<ResourceSearchRequest> = {
resource_type: withinEnum(Object.values(ResourceTypeEnum)),
department: withinEnum(Object.values(DepartmentEnum)),
department: withinEnum(Object.values(PATCHED_DEPARTMENT_VALUES)),
level: withinEnum(Object.values(LevelEnum)),
platform: withinEnum(Object.values(PlatformEnum)),
offered_by: withinEnum(Object.values(OfferedByEnum)),
Expand Down
Loading