From 17e06e429f58808df830be4deae2a29532d367b4 Mon Sep 17 00:00:00 2001 From: Anastasia Beglova Date: Tue, 2 Jul 2024 14:09:11 -0400 Subject: [PATCH] resource category (#117) --- package.json | 2 +- src/facet_display/types.ts | 1 + src/hooks/useInfiniteSearch.ts | 2 +- src/hooks/validation.ts | 4 +++- yarn.lock | 8 ++++---- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 3924baa..abade96 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/mitodl/course-search-utils#readme", "dependencies": { - "@mitodl/open-api-axios": "^2024.6.4", + "@mitodl/open-api-axios": "^2024.7.2", "axios": "^1.6.7", "fuse.js": "^7.0.0", "query-string": "^6.13.1", diff --git a/src/facet_display/types.ts b/src/facet_display/types.ts index 0298711..c123c12 100644 --- a/src/facet_display/types.ts +++ b/src/facet_display/types.ts @@ -55,6 +55,7 @@ export interface Facets { content_feature_type?: string[] learning_format?: string[] certification_type?: string[] + resource_category?: string[] } export interface BooleanFacets { diff --git a/src/hooks/useInfiniteSearch.ts b/src/hooks/useInfiniteSearch.ts index beb0f00..87c6d15 100644 --- a/src/hooks/useInfiniteSearch.ts +++ b/src/hooks/useInfiniteSearch.ts @@ -7,7 +7,7 @@ type ResourceSearchRequest = v1.LearningResourcesSearchApiLearningResourcesSearchRetrieveRequest type ContentFileSearchRequest = v1.ContentFileSearchApiContentFileSearchRetrieveRequest -type SearchResponse = v1.LearningResourceSearchResponse +type SearchResponse = v1.LearningResourcesSearchResponse type Status = "pending" | "error" | "success" diff --git a/src/hooks/validation.ts b/src/hooks/validation.ts index 8fd4614..36de2fc 100644 --- a/src/hooks/validation.ts +++ b/src/hooks/validation.ts @@ -9,6 +9,7 @@ const { LearningResourcesSearchRetrieveSortbyEnum: SortByEnum, LearningResourcesSearchRetrieveAggregationsEnum: AggregationsEnum, LearningResourcesSearchRetrieveLearningFormatEnum: LearningFormatEnum, + LearningResourcesSearchRetrieveResourceCategoryEnum: ResourceCategoryEnum, CertificationTypeEnum, ContentFileSearchRetrieveSortbyEnum, ContentFileSearchRetrieveAggregationsEnum @@ -57,7 +58,8 @@ const resourceSearchValidators: QueryParamValidators = { id: numbers, free: firstBoolean, learning_format: withinEnum(Object.values(LearningFormatEnum)), - certification_type: withinEnum(Object.values(CertificationTypeEnum)) + certification_type: withinEnum(Object.values(CertificationTypeEnum)), + resource_category: withinEnum(Object.values(ResourceCategoryEnum)) } const contentSearchValidators: QueryParamValidators = diff --git a/yarn.lock b/yarn.lock index 34aefb4..2497451 100644 --- a/yarn.lock +++ b/yarn.lock @@ -762,10 +762,10 @@ dependencies: make-plural "^7.0.0" -"@mitodl/open-api-axios@^2024.6.4": - version "2024.6.4" - resolved "https://registry.yarnpkg.com/@mitodl/open-api-axios/-/open-api-axios-2024.6.4.tgz#e906b764b115665858570f4bbf04bc065a2eeb4f" - integrity sha512-oJ3AwyDTrHOQXairhtqHyBHb9CzIf7En2gV7y6BANDKXhYGXKOVvxqWtvV+1jsCzgGWT6A2nBXYsKuVIGoAP6w== +"@mitodl/open-api-axios@^2024.7.2": + version "2024.7.2" + resolved "https://registry.yarnpkg.com/@mitodl/open-api-axios/-/open-api-axios-2024.7.2.tgz#7d33927e55b0ac8be7971e9f96455329e2778b20" + integrity sha512-x4NyMEjxjNZ3ppqq9gNO4oI83ZuoAJaCdwVQw2kBWC6RZgV7vcPdqlXIkKg1JtaY9ubqQxlQ82BtmlrFhTuIyQ== dependencies: "@types/node" "^20.11.19" axios "^1.6.5"