package be.vandewalleh.extensions import be.vandewalleh.kodein import be.vandewalleh.services.NotesService import be.vandewalleh.tables.Notes import io.ktor.http.* import org.kodein.di.generic.instance private val notesService by kodein.instance() fun Parameters.noteTitle(): String { return this["noteTitle"]!! } /** * Method that returns a [Notes] ID from it's title and the currently logged in user. * returns null if none found */ fun Parameters.noteId(userId: Int): Int? { val title = noteTitle() return notesService.getNoteIdFromUserIdAndTitle(userId, title) }