Skip to content

Commit

Permalink
fix(content): too slow when decode content
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Sep 29, 2022
1 parent 0856514 commit 201c809
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ final case class RequestContent(
) extends Request[RequestContent] {
// NOTE: see `net.yoshinorin.qualtet.domains.Request` comment.
def postDecode: RequestContent = {
for {
_ <- this.title.trimOrThrow(BadRequest("title required."))
_ <- this.rawContent.trimOrThrow(BadRequest("rawContent required."))
_ <- this.htmlContent.trimOrThrow(BadRequest("htmlContent required."))
} yield ()
this.copy(
robotsAttributes = this.robotsAttributes.sort
new RequestContent(
requestId = requestId,
contentType = contentType,
robotsAttributes = this.robotsAttributes.sort,
externalResources = externalResources,
tags = tags,
path = path,
title = title.trimOrThrow(BadRequest("title required.")),
rawContent = rawContent.trimOrThrow(BadRequest("rawContent required.")),
htmlContent = htmlContent.trimOrThrow(BadRequest("htmlContent required.")),
publishedAt = publishedAt,
updatedAt = updatedAt
)
}
}
Expand Down

0 comments on commit 201c809

Please sign in to comment.