unify receive or null in read modules
This commit is contained in:
parent
2fb346f6c7
commit
a3cc3e8537
@ -20,7 +20,7 @@ import org.joda.time.DateTime
|
|||||||
|
|
||||||
fun Route.includePostsCoreReadModules(readPostsAPI: ReadPostsAPI) {
|
fun Route.includePostsCoreReadModules(readPostsAPI: ReadPostsAPI) {
|
||||||
post(getPostByIdAddress) {
|
post(getPostByIdAddress) {
|
||||||
call.receiveOrNull(PostId::class) ?.also { id ->
|
call.receiveOrNull<PostId>() ?.also { id ->
|
||||||
val post = readPostsAPI.getPostById(id)
|
val post = readPostsAPI.getPostById(id)
|
||||||
post ?.let {
|
post ?.let {
|
||||||
val simplePost = post.asSimplePost
|
val simplePost = post.asSimplePost
|
||||||
@ -29,7 +29,7 @@ fun Route.includePostsCoreReadModules(readPostsAPI: ReadPostsAPI) {
|
|||||||
} ?: call.answerBadRequest("Id of post")
|
} ?: call.answerBadRequest("Id of post")
|
||||||
}
|
}
|
||||||
post(getPostsByContentIdAddress) {
|
post(getPostsByContentIdAddress) {
|
||||||
call.receiveOrNull(ContentId::class) ?.also { id ->
|
call.receiveOrNull<ContentId>() ?.also { id ->
|
||||||
val posts = readPostsAPI.getPostsByContent(id)
|
val posts = readPostsAPI.getPostsByContent(id)
|
||||||
val simplePosts = posts.asSimplePostList
|
val simplePosts = posts.asSimplePostList
|
||||||
call.answer(postsSerializer, simplePosts)
|
call.answer(postsSerializer, simplePosts)
|
||||||
|
Loading…
Reference in New Issue
Block a user