diff --git a/src/constants.ts b/src/constants.ts index ab1035a..d9aee04 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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", diff --git a/src/hooks/validation.ts b/src/hooks/validation.ts index bc01be7..29a9d4f 100644 --- a/src/hooks/validation.ts +++ b/src/hooks/validation.ts @@ -45,9 +45,16 @@ type QueryParamValidators = { [k in keyof Required]: (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 = { 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)),