From 153c8a6ac8a48f95ef263001af8d7a6274f96a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Brychta?= Date: Tue, 3 Dec 2024 17:29:29 +0000 Subject: [PATCH] Remove ID from filterable paths #5825 --- .../weco/api/search/rest/ImagesParams.scala | 24 +++++++++---------- .../weco/api/search/rest/WorksParams.scala | 24 +++++++++---------- .../api/search/images/ImagesFiltersTest.scala | 6 ++--- .../api/search/works/WorksErrorsTest.scala | 2 +- .../api/search/works/WorksFiltersTest.scala | 6 ++--- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/search/src/main/scala/weco/api/search/rest/ImagesParams.scala b/search/src/main/scala/weco/api/search/rest/ImagesParams.scala index 4b4e99cd8..050dc161f 100644 --- a/search/src/main/scala/weco/api/search/rest/ImagesParams.scala +++ b/search/src/main/scala/weco/api/search/rest/ImagesParams.scala @@ -46,11 +46,11 @@ case class MultipleImagesParams( query: Option[String], license: Option[LicenseFilter], `source.contributors.agent.label`: Option[ContributorsLabelFilter], - `source.contributors.agent.id`: Option[ContributorsIdFilter], + `source.contributors.agent`: Option[ContributorsIdFilter], `source.genres.label`: Option[GenreLabelFilter], - `source.genres.id`: Option[GenreIdFilter], + `source.genres`: Option[GenreIdFilter], `source.subjects.label`: Option[SubjectLabelFilter], - `source.subjects.id`: Option[SubjectIdFilter], + `source.subjects`: Option[SubjectIdFilter], `source.production.dates.from`: Option[LocalDate], `source.production.dates.to`: Option[LocalDate], color: Option[RgbColor], @@ -75,11 +75,11 @@ case class MultipleImagesParams( List( license, `source.contributors.agent.label`, - `source.contributors.agent.id`, + `source.contributors.agent`, `source.genres.label`, - `source.genres.id`, + `source.genres`, `source.subjects.label`, - `source.subjects.id`, + `source.subjects`, dateFilter ).flatten @@ -102,11 +102,11 @@ object MultipleImagesParams extends QueryParamsUtils { "query".as[String].?, "locations.license".as[LicenseFilter].?, "source.contributors.agent.label".as[ContributorsLabelFilter].?, - "source.contributors.agent.id".as[ContributorsIdFilter].?, + "source.contributors.agent".as[ContributorsIdFilter].?, "source.genres.label".as[GenreLabelFilter].?, - "source.genres.id".as[GenreIdFilter].?, + "source.genres".as[GenreIdFilter].?, "source.subjects.label".as[SubjectLabelFilter].?, - "source.subjects.id".as[SubjectIdFilter].?, + "source.subjects".as[SubjectIdFilter].?, "source.production.dates.from".as[LocalDate].?, "source.production.dates.to".as[LocalDate].?, "color".as[RgbColor].?, @@ -139,11 +139,11 @@ object MultipleImagesParams extends QueryParamsUtils { decodeOneOfCommaSeparated( "locations.license" -> ImageAggregationRequest.License, "source.contributors.agent.label" -> ImageAggregationRequest.SourceContributorAgentsLabel, - "source.contributors.agent.id" -> ImageAggregationRequest.SourceContributorAgentsId, + "source.contributors.agent" -> ImageAggregationRequest.SourceContributorAgentsId, "source.genres.label" -> ImageAggregationRequest.SourceGenresLabel, - "source.genres.id" -> ImageAggregationRequest.SourceGenresId, + "source.genres" -> ImageAggregationRequest.SourceGenresId, "source.subjects.label" -> ImageAggregationRequest.SourceSubjectsLabel, - "source.subjects.id" -> ImageAggregationRequest.SourceSubjectsId + "source.subjects" -> ImageAggregationRequest.SourceSubjectsId ) implicit val sortDecoder: Decoder[List[SortRequest]] = diff --git a/search/src/main/scala/weco/api/search/rest/WorksParams.scala b/search/src/main/scala/weco/api/search/rest/WorksParams.scala index f93af07bb..e1ea9df05 100644 --- a/search/src/main/scala/weco/api/search/rest/WorksParams.scala +++ b/search/src/main/scala/weco/api/search/rest/WorksParams.scala @@ -76,11 +76,11 @@ case class WorkFilterParams( `production.dates.to`: Option[LocalDate], languages: Option[LanguagesFilter], `genres.label`: Option[GenreLabelFilter], - `genres.id`: Option[GenreIdFilter], + `genres`: Option[GenreIdFilter], `subjects.label`: Option[SubjectLabelFilter], - `subjects.id`: Option[SubjectIdFilter], + `subjects`: Option[SubjectIdFilter], `contributors.agent.label`: Option[ContributorsLabelFilter], - `contributors.agent.id`: Option[ContributorsIdFilter], + `contributors.agent`: Option[ContributorsIdFilter], identifiers: Option[IdentifiersFilter], partOf: Option[PartOfFilter], `partOf.title`: Option[PartOfTitleFilter], @@ -120,11 +120,11 @@ case class MultipleWorksParams( dateFilter, filterParams.languages, filterParams.`genres.label`, - filterParams.`genres.id`, + filterParams.`genres`, filterParams.`subjects.label`, - filterParams.`subjects.id`, + filterParams.`subjects`, filterParams.`contributors.agent.label`, - filterParams.`contributors.agent.id`, + filterParams.`contributors.agent`, filterParams.identifiers, itemsParams.`items`, itemsParams.`items.identifiers`, @@ -204,11 +204,11 @@ object MultipleWorksParams extends QueryParamsUtils { "production.dates.to".as[LocalDate].?, "languages".as[LanguagesFilter].?, "genres.label".as[GenreLabelFilter].?, - "genres.id".as[GenreIdFilter].?, + "genres".as[GenreIdFilter].?, "subjects.label".as[SubjectLabelFilter].?, - "subjects.id".as[SubjectIdFilter].?, + "subjects".as[SubjectIdFilter].?, "contributors.agent.label".as[ContributorsLabelFilter].?, - "contributors.agent.id".as[ContributorsIdFilter].?, + "contributors.agent".as[ContributorsIdFilter].?, "identifiers".as[IdentifiersFilter].?, "partOf".as[PartOfFilter].?, "partOf.title".as[PartOfTitleFilter].?, @@ -303,13 +303,13 @@ object MultipleWorksParams extends QueryParamsUtils { decodeOneOfCommaSeparated( "workType" -> WorkAggregationRequest.Format, "genres.label" -> WorkAggregationRequest.GenreLabel, - "genres.id" -> WorkAggregationRequest.GenreId, + "genres" -> WorkAggregationRequest.GenreId, "production.dates" -> WorkAggregationRequest.ProductionDate, "subjects.label" -> WorkAggregationRequest.SubjectLabel, - "subjects.id" -> WorkAggregationRequest.SubjectId, + "subjects" -> WorkAggregationRequest.SubjectId, "languages" -> WorkAggregationRequest.Languages, "contributors.agent.label" -> WorkAggregationRequest.ContributorLabel, - "contributors.agent.id" -> WorkAggregationRequest.ContributorId, + "contributors.agent" -> WorkAggregationRequest.ContributorId, "items.locations.license" -> WorkAggregationRequest.License, "availabilities" -> WorkAggregationRequest.Availabilities ) diff --git a/search/src/test/scala/weco/api/search/images/ImagesFiltersTest.scala b/search/src/test/scala/weco/api/search/images/ImagesFiltersTest.scala index 790b1a25c..20b66b172 100644 --- a/search/src/test/scala/weco/api/search/images/ImagesFiltersTest.scala +++ b/search/src/test/scala/weco/api/search/images/ImagesFiltersTest.scala @@ -133,7 +133,7 @@ class ImagesFiltersTest extends AnyFunSpec with ApiImagesTestBase { withGenreFilterRecords { routes => assertJsonResponse( routes, - path = s"$rootPath/images?source.genres.id=" + path = s"$rootPath/images?source.genres=" ) { Status.OK -> imagesListResponse( ids = Seq( @@ -150,7 +150,7 @@ class ImagesFiltersTest extends AnyFunSpec with ApiImagesTestBase { withGenreFilterRecords { routes => assertJsonResponse( routes, - path = s"$rootPath/images?source.genres.id=baadf00d" + path = s"$rootPath/images?source.genres=baadf00d" ) { Status.OK -> imagesListResponse( ids = Seq( @@ -167,7 +167,7 @@ class ImagesFiltersTest extends AnyFunSpec with ApiImagesTestBase { withGenreFilterRecords { routes => assertJsonResponse( routes, - path = s"$rootPath/images?source.genres.id=g00dcafe,baadf00d" + path = s"$rootPath/images?source.genres=g00dcafe,baadf00d" ) { Status.OK -> imagesListResponse( ids = Seq( diff --git a/search/src/test/scala/weco/api/search/works/WorksErrorsTest.scala b/search/src/test/scala/weco/api/search/works/WorksErrorsTest.scala index 165f95a02..7f3dd7d66 100644 --- a/search/src/test/scala/weco/api/search/works/WorksErrorsTest.scala +++ b/search/src/test/scala/weco/api/search/works/WorksErrorsTest.scala @@ -54,7 +54,7 @@ class WorksErrorsTest extends AnyFunSpec with ApiWorksTestBase with TableDrivenP } val aggregationsString = - "['workType', 'genres.label', 'genres.id', 'production.dates', 'subjects.label', 'subjects.id', 'languages', 'contributors.agent.label', 'contributors.agent.id', 'items.locations.license', 'availabilities']" + "['workType', 'genres.label', 'genres', 'production.dates', 'subjects.label', 'subjects', 'languages', 'contributors.agent.label', 'contributors.agent', 'items.locations.license', 'availabilities']" describe( "returns a 400 Bad Request for errors in the ?aggregations parameter" diff --git a/search/src/test/scala/weco/api/search/works/WorksFiltersTest.scala b/search/src/test/scala/weco/api/search/works/WorksFiltersTest.scala index 0a2774363..8c4c6e7c3 100644 --- a/search/src/test/scala/weco/api/search/works/WorksFiltersTest.scala +++ b/search/src/test/scala/weco/api/search/works/WorksFiltersTest.scala @@ -168,7 +168,7 @@ class WorksFiltersTest withGenreIdFilterRecords { routes => assertJsonResponse( routes, - path = s"$rootPath/works?genres.id=" + path = s"$rootPath/works?genres=" ) { Status.OK -> worksListResponse( ids = Seq( @@ -188,7 +188,7 @@ class WorksFiltersTest withGenreIdFilterRecords { routes => assertJsonResponse( routes, - path = s"$rootPath/works?genres.id=baadf00d" + path = s"$rootPath/works?genres=baadf00d" ) { Status.OK -> worksListResponse( ids = Seq( @@ -206,7 +206,7 @@ class WorksFiltersTest withGenreIdFilterRecords { routes => assertJsonResponse( routes, - path = s"$rootPath/works?genres.id=g00dcafe,baadf00d" + path = s"$rootPath/works?genres=g00dcafe,baadf00d" ) { Status.OK -> worksListResponse( ids = Seq(