diff --git a/api/src/features/ContentNegotiationFeature.kt b/api/src/features/ContentNegotiationFeature.kt index 3b91178..8906914 100644 --- a/api/src/features/ContentNegotiationFeature.kt +++ b/api/src/features/ContentNegotiationFeature.kt @@ -7,8 +7,6 @@ import io.ktor.jackson.* fun Application.contentNegotiationFeature() { install(ContentNegotiation) { - jackson { - enable(SerializationFeature.INDENT_OUTPUT) - } + jackson {} } } \ No newline at end of file diff --git a/api/src/routing/NotesController.kt b/api/src/routing/NotesController.kt index ac2e587..4015312 100644 --- a/api/src/routing/NotesController.kt +++ b/api/src/routing/NotesController.kt @@ -8,15 +8,19 @@ import io.ktor.response.* import io.ktor.routing.* import org.kodein.di.Kodein import org.kodein.di.generic.instance +import kotlin.system.measureTimeMillis fun Routing.notes(kodein: Kodein) { val notesService by kodein.instance() authenticate { get("/notes") { - val userId = call.userId() - val notes = notesService.getNotes(userId) - call.respond(notes) + val time = measureTimeMillis { + val userId = call.userId() + val notes = notesService.getNotes(userId) + call.respond(notes) + } + application.log.info("Time taken: $time ms") } } } diff --git a/api/src/services/NotesService.kt b/api/src/services/NotesService.kt index 1f31991..f89c829 100644 --- a/api/src/services/NotesService.kt +++ b/api/src/services/NotesService.kt @@ -25,19 +25,14 @@ class NotesService(override val kodein: Kodein) : KodeinAware { .where { Notes.userId eq userId } .orderBy(Notes.updatedAt.desc()) .map { row -> - Notes.createEntity(row) - } - .toList() - .map { note -> val tags = db.from(Tags) .select(Tags.name) - .where { Tags.noteId eq note.id } + .where { Tags.noteId eq row[Notes.id]!! } .map { it[Tags.name]!! } - .toList() - val updatedAt = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(note.updatedAt) + val updatedAt = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(row[Notes.updatedAt]!!) - NotesDTO(note.title, tags, updatedAt) + NotesDTO(row[Notes.title]!!, tags, updatedAt) } fun getNoteIdFromUserIdAndTitle(userId: Int, noteTitle: String): Int? = db.from(Notes) diff --git a/frontend/components/Note.vue b/frontend/components/Note.vue index 5794867..4a0ae76 100644 --- a/frontend/components/Note.vue +++ b/frontend/components/Note.vue @@ -2,27 +2,34 @@
- {{ title }} - -
- {{ tag }} -
-
- -
- - Last updated {{ updatedAt }} + + +
+ Last updated {{ updatedAt }} +
+ +

{{ title }}

+
+
+
+ +
+ + {{ tag }} + +
+
diff --git a/frontend/layouts/default.vue b/frontend/layouts/default.vue index 61a4594..c364f9e 100644 --- a/frontend/layouts/default.vue +++ b/frontend/layouts/default.vue @@ -4,7 +4,7 @@ Simple Notes My notes - + Welcome {{ this.$store.state.auth.user.username }} Account diff --git a/frontend/pages/notes.vue b/frontend/pages/notes.vue index 1fc7d64..586b26a 100644 --- a/frontend/pages/notes.vue +++ b/frontend/pages/notes.vue @@ -1,48 +1,98 @@ + +