WIP
This commit is contained in:
parent
a1cd1d7403
commit
7be4acd6e9
@ -12,10 +12,7 @@ import io.ktor.application.call
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.request.receive
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.Routing
|
||||
import io.ktor.routing.get
|
||||
import io.ktor.routing.post
|
||||
import io.ktor.routing.*
|
||||
import me.liuwj.ktorm.database.Database
|
||||
import me.liuwj.ktorm.dsl.*
|
||||
import me.liuwj.ktorm.entity.*
|
||||
@ -57,6 +54,8 @@ class NotesTitleController(kodein: Kodein) : AuthCrudController("/notes/{noteTit
|
||||
private class ChapterDto(val title: String, val content: String)
|
||||
private class GetResponseBody(val tags: List<String>, val chapters: List<ChapterDto>)
|
||||
|
||||
private class PatchRequestBody(val title: String? = null, val tags: List<String>? = null)
|
||||
|
||||
override val route: Route.() -> Unit = {
|
||||
post {
|
||||
val title = call.noteTitle() ?: error("")
|
||||
@ -113,5 +112,17 @@ class NotesTitleController(kodein: Kodein) : AuthCrudController("/notes/{noteTit
|
||||
|
||||
call.respond(response)
|
||||
}
|
||||
|
||||
patch {
|
||||
val requestedChanges = call.receive<PatchRequestBody>()
|
||||
|
||||
// This means no changes have been requested..
|
||||
if (requestedChanges.tags == null && requestedChanges.title == null) {
|
||||
return@patch call.respondStatus(HttpStatusCode.BadRequest)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user