Log discarded html tags + small refactor
This commit is contained in:
@@ -27,7 +27,7 @@ class ApiNoteController(
|
||||
|
||||
fun createNote(request: Request, loggedInUser: LoggedInUser): Response {
|
||||
val content = noteContentLens(request)
|
||||
return noteService.create(loggedInUser.userId, content).fold(
|
||||
return noteService.create(loggedInUser, content).fold(
|
||||
{ Response(BAD_REQUEST) },
|
||||
{ uuidContentLens(UuidContent(it.uuid), Response(OK)) }
|
||||
)
|
||||
@@ -45,7 +45,7 @@ class ApiNoteController(
|
||||
|
||||
fun update(request: Request, loggedInUser: LoggedInUser): Response {
|
||||
val content = noteContentLens(request)
|
||||
return noteService.update(loggedInUser.userId, uuidLens(request), content).fold(
|
||||
return noteService.update(loggedInUser, uuidLens(request), content).fold(
|
||||
{
|
||||
Response(BAD_REQUEST)
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ class NoteController(
|
||||
|
||||
val markdownForm = request.form("markdown") ?: ""
|
||||
|
||||
return noteService.create(loggedInUser.userId, markdownForm).fold(
|
||||
return noteService.create(loggedInUser, markdownForm).fold(
|
||||
{
|
||||
val html = when (it) {
|
||||
MissingMeta -> view.noteEditor(
|
||||
@@ -112,7 +112,7 @@ class NoteController(
|
||||
|
||||
val markdownForm = request.form("markdown") ?: ""
|
||||
|
||||
return noteService.update(loggedInUser.userId, note.uuid, markdownForm).fold(
|
||||
return noteService.update(loggedInUser, note.uuid, markdownForm).fold(
|
||||
{
|
||||
val html = when (it) {
|
||||
MissingMeta -> view.noteEditor(
|
||||
|
||||
@@ -44,7 +44,7 @@ class ApiRoutes(
|
||||
"/" bind POST to transaction.then(::createNote),
|
||||
"/search" bind POST to ::search,
|
||||
"/{uuid}" bind GET to ::note,
|
||||
"/{uuid}" bind PUT to transaction.then(::note),
|
||||
"/{uuid}" bind PUT to transaction.then(::update),
|
||||
)
|
||||
).withBasePath("/notes")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user