Fix 404 logic
This commit is contained in:
@@ -34,7 +34,7 @@ fun Routing.title(kodein: Kodein) {
|
|||||||
val noteUuid = call.parameters.noteUuid()
|
val noteUuid = call.parameters.noteUuid()
|
||||||
|
|
||||||
val exists = notesService.noteExists(userId, 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)
|
val notePatch = call.receiveNotePatch().copy(uuid = noteUuid)
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ fun Routing.title(kodein: Kodein) {
|
|||||||
val noteUuid = call.parameters.noteUuid()
|
val noteUuid = call.parameters.noteUuid()
|
||||||
|
|
||||||
val exists = notesService.noteExists(userId, 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)
|
notesService.deleteNote(noteUuid)
|
||||||
call.respondStatus(HttpStatusCode.OK)
|
call.respondStatus(HttpStatusCode.OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user