Fix 404 logic

This commit is contained in:
Hubert Van De Walle 2020-04-25 18:45:15 +02:00
parent a9ec03d58f
commit f1eed842d2

View File

@ -34,7 +34,7 @@ fun Routing.title(kodein: Kodein) {
val noteUuid = call.parameters.noteUuid()
val exists = notesService.noteExists(userId, noteUuid)
if (exists) return@patch call.respondStatus(HttpStatusCode.NotFound)
if (!exists) return@patch call.respondStatus(HttpStatusCode.NotFound)
val notePatch = call.receiveNotePatch().copy(uuid = noteUuid)
@ -47,7 +47,7 @@ fun Routing.title(kodein: Kodein) {
val noteUuid = call.parameters.noteUuid()
val exists = notesService.noteExists(userId, noteUuid)
if (exists) return@delete call.respondStatus(HttpStatusCode.NotFound)
if (!exists) return@delete call.respondStatus(HttpStatusCode.NotFound)
notesService.deleteNote(noteUuid)
call.respondStatus(HttpStatusCode.OK)