Persistance: Note can now be put in the trash

This commit is contained in:
2020-08-17 18:51:33 +02:00
parent 4e2fe463e0
commit 15de81394c
8 changed files with 120 additions and 34 deletions
@@ -55,10 +55,10 @@ class NoteController(
val noteUuid = request.uuidPath() ?: return Response(NOT_FOUND)
if (request.method == Method.POST && request.form("delete") != null) {
return if (noteService.delete(jwtPayload.userId, noteUuid))
Response.redirect("/notes") // FIXME: flash cookie to show success ?
return if (noteService.trash(jwtPayload.userId, noteUuid))
Response.redirect("/notes") // TODO: flash cookie to show success ?
else
Response(NOT_FOUND) // FIXME: show an error
Response(NOT_FOUND) // TODO: show an error
}
val note = noteService.find(jwtPayload.userId, noteUuid) ?: return Response(NOT_FOUND)