Lots of things

This commit is contained in:
2020-06-22 17:34:45 +02:00
parent f134a83604
commit 3306b16f91
21 changed files with 482 additions and 344 deletions
@@ -1,12 +1,9 @@
package be.vandewalleh.extensions
import be.vandewalleh.auth.UserDbIdPrincipal
import be.vandewalleh.services.FullNoteCreateDTO
import be.vandewalleh.services.FullNotePatchDTO
import io.ktor.application.*
import io.ktor.auth.*
import io.ktor.http.*
import io.ktor.request.*
import io.ktor.response.*
suspend fun ApplicationCall.respondStatus(status: HttpStatusCode) {
@@ -17,9 +14,3 @@ suspend fun ApplicationCall.respondStatus(status: HttpStatusCode) {
* @return the userId for the currently authenticated user
*/
fun ApplicationCall.userId() = principal<UserDbIdPrincipal>()!!.id
class NoteCreate(val title: String, val tags: List<String>)
suspend fun ApplicationCall.receiveNoteCreate(): FullNoteCreateDTO = receive()
suspend fun ApplicationCall.receiveNotePatch(): FullNotePatchDTO = receive()
+1 -5
View File
@@ -3,10 +3,6 @@ package be.vandewalleh.extensions
import io.ktor.http.*
import java.util.*
fun Parameters.noteTitle(): String {
return this["noteTitle"]!!
}
fun Parameters.noteUuid(): UUID {
return UUID.fromString(this["noteUuid"])
}
}