Remove Extra class, and create CommentRef

This commit is contained in:
2020-01-29 16:58:14 +01:00
parent 41a98f23b8
commit 3d2d3c2e14
6 changed files with 42 additions and 29 deletions

View File

@@ -79,7 +79,7 @@ fun Application.module(env: Env = PROD) {
decode { values, _ ->
values.singleOrNull()?.let {
get<RepositoryArticle>().findById(UUID.fromString(it))
?: throw InternalError("Article $values not found")
?: throw NotFoundException("Article $values not found")
} ?: throw NotFoundException("Article $values not found")
}
}
@@ -91,6 +91,14 @@ fun Application.module(env: Env = PROD) {
}
}
convert<CommentRef> {
decode { values, _ ->
values.singleOrNull()?.let {
CommentRef(UUID.fromString(it))
} ?: throw NotFoundException("Comment $values not found")
}
}
convert<Constitution> {
decode { values, _ ->
val id = values.singleOrNull()?.let { UUID.fromString(it) }