Remove converter for CommentRef

This commit is contained in:
2021-02-05 21:48:33 +01:00
parent aeaab860b2
commit 8ead83941f
4 changed files with 13 additions and 11 deletions

View File

@@ -16,11 +16,13 @@ import io.ktor.locations.post
import io.ktor.request.receive
import io.ktor.response.respond
import io.ktor.routing.Route
import java.util.UUID
@KtorExperimentalLocationsAPI
object CreateCommentChildren {
@Location("/comments/{comment}/children")
class CreateCommentChildrenRequest(val comment: CommentRef) {
class CreateCommentChildrenRequest(comment: UUID) {
val comment = CommentRef(comment)
class Input(val content: String)
}

View File

@@ -14,11 +14,14 @@ import io.ktor.locations.put
import io.ktor.request.receiveText
import io.ktor.response.respond
import io.ktor.routing.Route
import java.util.UUID
@KtorExperimentalLocationsAPI
object EditComment {
@Location("/comments/{comment}")
class EditCommentRequest(val comment: CommentRef)
class EditCommentRequest(comment: UUID) {
val comment = CommentRef(comment)
}
fun Route.editComment(repo: CommentRepository, ac: CommentAccessControl) {
put<EditCommentRequest> {

View File

@@ -13,11 +13,14 @@ import io.ktor.locations.Location
import io.ktor.locations.get
import io.ktor.response.respond
import io.ktor.routing.Route
import java.util.UUID
@KtorExperimentalLocationsAPI
object GetOneComment {
@Location("/comments/{comment}")
class CommentRequest(val comment: CommentRef)
class CommentRequest(comment: UUID) {
val comment = CommentRef(comment)
}
fun Route.getOneComment(repo: CommentRepository, ac: CommentAccessControl) {
get<CommentRequest> {