Add tags request to NotesService

This commit is contained in:
Hubert Van De Walle 2020-04-23 00:22:34 +02:00
parent 765f96cedf
commit 468e2dee6f

View File

@ -111,6 +111,12 @@ class NotesService(override val kodein: Kodein) : KodeinAware {
db.useTransaction { db.useTransaction {
db.delete(Notes) { it.id eq noteId } db.delete(Notes) { it.id eq noteId }
} }
fun getTags(userId: Int): List<String> = db.from(Tags)
.leftJoin(Notes, on = Tags.noteId eq Notes.id)
.select(Tags.name)
.where { Notes.userId eq userId }
.map { it[Tags.name]!! }
} }
data class ChaptersDTO(val title: String, val content: String) data class ChaptersDTO(val title: String, val content: String)