Skip to content

Commit

Permalink
Update priority type in MultiSearchSummary. Generate TS for search-api.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinewi committed Nov 13, 2023
1 parent cdf9e04 commit f6d6241
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}
Expand Down
16 changes: 1 addition & 15 deletions typescript/search-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export interface IMultiSearchSummary {
responsible?: IDraftResponsible
comments?: IComment[]
prioritized?: boolean
priority?: Priority
priority?: string
}

export interface IMultiSearchTermsAggregation {
Expand All @@ -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
Expand Down Expand Up @@ -239,10 +231,6 @@ export interface ITitle {
language: string
}

export interface IUnspecified {
type: "Unspecified"
}

export interface IValidationError {
code: string
description: string
Expand All @@ -254,5 +242,3 @@ export interface IValidationMessage {
field: string
message: string
}

export type Priority = (IOnHold | IPrioritized | IUnspecified)

0 comments on commit f6d6241

Please sign in to comment.