in src/main/scala/managehelpcontentpublisher/Article.scala [14:30]
def fromInput(input: InputArticle): Article = Article(
title = input.title,
body = HtmlToJson(input.body),
path = input.urlName,
topics = input.dataCategories.map(ArticleTopic.fromSalesforceDataCategory)
)
def readArticle(jsonString: String): Either[Failure, Article] =
Try(read[Article](jsonString)).toEither.left.map(e => ResponseFailure(s"Failed to read article: ${e.getMessage}"))
def writeArticle(article: Article): Either[Failure, String] =
Try(write(article)).toEither.left.map(e => ResponseFailure(s"Failed to write article: ${e.getMessage}"))
}
case class ArticleTopic(path: String, title: String)
object ArticleTopic {