Skip to content

Commit

Permalink
update to summary instead of content
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrojo77 committed Oct 24, 2024
1 parent 98e4f7e commit 27658b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package no.ndla.articleapi.service
import com.sksamuel.elastic4s.requests.searches.SearchHit
import com.typesafe.scalalogging.StrictLogging
import no.ndla.articleapi.Props
import no.ndla.articleapi.model.api.{ ArticleSummaryV2, ImportException, NotFoundException, PartialPublishArticle}
import no.ndla.articleapi.model.api.{ArticleSummaryV2, ImportException, NotFoundException, PartialPublishArticle}
import no.ndla.articleapi.model.domain.*
import no.ndla.articleapi.model.search.SearchableArticle
import no.ndla.articleapi.model.api
Expand All @@ -20,7 +20,18 @@ import no.ndla.common
import no.ndla.common.{CirceUtil, Clock, model}
import no.ndla.common.model.{RelatedContentLink, api as commonApi}
import no.ndla.common.model.api.{Delete, License, Missing, UpdateWith}
import no.ndla.common.model.domain.{ArticleContent, ArticleMetaImage, ArticleIntroSummary, Description, Introduction, RelatedContent, RequiredLibrary, Tag, Title, VisualElement}
import no.ndla.common.model.domain.{
ArticleContent,
ArticleMetaImage,
ArticleIntroSummary,
Description,
Introduction,
RelatedContent,
RequiredLibrary,
Tag,
Title,
VisualElement
}
import no.ndla.common.model.domain.article.{Article, Copyright}
import no.ndla.language.Language.{AllLanguages, UnknownLanguage, findByLanguageOrBestEffort, getSupportedLanguages}
import no.ndla.mapping.ISO639
Expand Down Expand Up @@ -249,7 +260,7 @@ trait ConverterService {
.getOrElse(api.ArticleContentV2("", UnknownLanguage.toString))
val metaImage = findByLanguageOrBestEffort(article.metaImage, language).map(toApiArticleMetaImage)
val copyright = toApiCopyright(article.copyright)
val summary = findByLanguageOrBestEffort(article.summary, language).map(toApiArticleIntroSummary)
val summary = findByLanguageOrBestEffort(article.summary, language).map(toApiArticleIntroSummary)
Success(
api.ArticleV2(
article.id.get,
Expand Down Expand Up @@ -376,11 +387,10 @@ trait ConverterService {

private def toApiArticleIntroSummary(introSummary: ArticleIntroSummary): api.ArticleIntroSummary = {
api.ArticleIntroSummary(
introSummary.content,
introSummary.summary,
introSummary.language
)
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder}
import no.ndla.language.model.LanguageField

case class ArticleIntroSummary(content: String, language: String) extends LanguageField[String] {
override def value: String = content
override def isEmpty: Boolean = content.isEmpty
case class ArticleIntroSummary(summary: String, language: String) extends LanguageField[String] {
override def value: String = summary
override def isEmpty: Boolean = summary.isEmpty
}

object ArticleIntroSummary {
Expand Down

0 comments on commit 27658b2

Please sign in to comment.