From f6d62413aada5baa6e56a22c5e673e34f67e689c Mon Sep 17 00:00:00 2001 From: Katrine Wist Date: Mon, 13 Nov 2023 14:44:25 +0100 Subject: [PATCH] Update priority type in MultiSearchSummary. Generate TS for search-api. --- .../searchapi/model/api/MultiSearchSummary.scala | 5 ++--- .../service/search/SearchConverterService.scala | 2 +- typescript/search-api.ts | 16 +--------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/search-api/src/main/scala/no/ndla/searchapi/model/api/MultiSearchSummary.scala b/search-api/src/main/scala/no/ndla/searchapi/model/api/MultiSearchSummary.scala index d46638045..7e5ef23b0 100644 --- a/search-api/src/main/scala/no/ndla/searchapi/model/api/MultiSearchSummary.scala +++ b/search-api/src/main/scala/no/ndla/searchapi/model/api/MultiSearchSummary.scala @@ -9,7 +9,6 @@ package no.ndla.searchapi.model.api import no.ndla.common.model.NDLADate import no.ndla.common.model.api.draft.Comment -import no.ndla.common.model.domain.Priority import org.scalatra.swagger.annotations.{ApiModel, ApiModelProperty} import scala.annotation.meta.field @@ -41,7 +40,7 @@ case class MultiSearchSummary( @(ApiModelProperty @field)(description = "A list of revisions planned for the article") revisions: Seq[RevisionMeta], @(ApiModelProperty @field)(description = "Responsible field") responsible: Option[DraftResponsible], @(ApiModelProperty @field)(description = "Information about comments attached to the article") comments: Option[Seq[Comment]], - @(ApiModelProperty @field)(description ="If the article should be prioritized" ) prioritized: Option[Boolean], - @(ApiModelProperty @field)(description ="If the article should be prioritized" ) priority: Option[Priority] + @(ApiModelProperty @field)(description = "If the article should be prioritized" ) prioritized: Option[Boolean], + @(ApiModelProperty @field)(description = "If the article should be prioritized. Possible values are prioritized, on-hold, unspecified") priority: Option[String] ) // format: on diff --git a/search-api/src/main/scala/no/ndla/searchapi/service/search/SearchConverterService.scala b/search-api/src/main/scala/no/ndla/searchapi/service/search/SearchConverterService.scala index cb553905b..0f9f54cb3 100644 --- a/search-api/src/main/scala/no/ndla/searchapi/service/search/SearchConverterService.scala +++ b/search-api/src/main/scala/no/ndla/searchapi/service/search/SearchConverterService.scala @@ -545,7 +545,7 @@ trait SearchConverterService { revisions = revisions, responsible = responsible, comments = Some(comments), - priority = Some(searchableDraft.priority), + priority = Some(searchableDraft.priority.entryName), prioritized = Some(searchableDraft.priority == Priority.Prioritized) ) } diff --git a/typescript/search-api.ts b/typescript/search-api.ts index d8794f6e9..62496cb35 100644 --- a/typescript/search-api.ts +++ b/typescript/search-api.ts @@ -177,7 +177,7 @@ export interface IMultiSearchSummary { responsible?: IDraftResponsible comments?: IComment[] prioritized?: boolean - priority?: Priority + priority?: string } export interface IMultiSearchTermsAggregation { @@ -187,14 +187,6 @@ export interface IMultiSearchTermsAggregation { values: ITermValue[] } -export interface IOnHold { - type: "OnHold" -} - -export interface IPrioritized { - type: "Prioritized" -} - export interface IRevisionMeta { revisionDate: string note: string @@ -239,10 +231,6 @@ export interface ITitle { language: string } -export interface IUnspecified { - type: "Unspecified" -} - export interface IValidationError { code: string description: string @@ -254,5 +242,3 @@ export interface IValidationMessage { field: string message: string } - -export type Priority = (IOnHold | IPrioritized | IUnspecified)