Add token renewal backend
This commit is contained in:
@@ -17,16 +17,18 @@ suspend fun ApplicationCall.respondStatus(status: HttpStatusCode) {
|
||||
respond(status, status.description)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the user email for the currently authenticated user
|
||||
*/
|
||||
fun ApplicationCall.userEmail() = principal<UserIdPrincipal>()!!.name
|
||||
|
||||
/**
|
||||
* @return the userId for the currently authenticated user
|
||||
*/
|
||||
fun ApplicationCall.userId(): Int {
|
||||
val email = principal<UserIdPrincipal>()!!.name
|
||||
return userService.getUserId(email)!!
|
||||
}
|
||||
fun ApplicationCall.userId() = userService.getUserId(userEmail())!!
|
||||
|
||||
class NoteCreate(val title: String, val tags: List<String>)
|
||||
|
||||
suspend fun ApplicationCall.receiveNoteCreate(): FullNoteCreateDTO = receive()
|
||||
|
||||
suspend fun ApplicationCall.receiveNotePatch() : FullNotePatchDTO = receive()
|
||||
suspend fun ApplicationCall.receiveNotePatch(): FullNotePatchDTO = receive()
|
||||
Reference in New Issue
Block a user