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) {
|
||||
post(getPostByIdAddress) {
|
||||
call.receiveOrNull(PostId::class) ?.also { id ->
|
||||
call.receiveOrNull<PostId>() ?.also { id ->
|
||||
val post = readPostsAPI.getPostById(id)
|
||||
post ?.let {
|
||||
val simplePost = post.asSimplePost
|
||||
@ -29,7 +29,7 @@ fun Route.includePostsCoreReadModules(readPostsAPI: ReadPostsAPI) {
|
||||
} ?: call.answerBadRequest("Id of post")
|
||||
}
|
||||
post(getPostsByContentIdAddress) {
|
||||
call.receiveOrNull(ContentId::class) ?.also { id ->
|
||||
call.receiveOrNull<ContentId>() ?.also { id ->
|
||||
val posts = readPostsAPI.getPostsByContent(id)
|
||||
val simplePosts = posts.asSimplePostList
|
||||
call.answer(postsSerializer, simplePosts)
|
||||
|
Loading…
Reference in New Issue
Block a user