feat/gitignore #9

Merged
mt merged 5 commits from feat/gitignore into main 2026-09-14 10:13:13 +00:00
Showing only changes of commit aabf94941a - Show all commits

View file

@ -117,8 +117,6 @@ fun Application.configureRouting(
return@post return@post
} }
authenticate("auth-jwt") { authenticate("auth-jwt") {
@ -135,7 +133,10 @@ fun Application.configureRouting(
val principal = call.principal<UserPrincipal>() val principal = call.principal<UserPrincipal>()
val userId = principal?.userId val userId = principal?.userId
if (userId == null) { if (userId == null) {
call.respond(HttpStatusCode.Unauthorized, mapOf("error" to "Ungültiges oder abgelaufenes Token")) call.respond(
HttpStatusCode.Unauthorized,
mapOf("error" to "Ungültiges oder abgelaufenes Token")
)
return@post return@post
} }
val taskInfo = repository.getTaskAnswerAndReward(request.taskId) val taskInfo = repository.getTaskAnswerAndReward(request.taskId)
@ -199,7 +200,8 @@ fun Application.configureRouting(
// Wir holen die echte, fälschungssichere userId aus dem Login-Token: // Wir holen die echte, fälschungssichere userId aus dem Login-Token:
val principal = call.principal<UserPrincipal>() val principal = call.principal<UserPrincipal>()
val userId = principal?.userId ?: request.userId // Fallback auf request.userId, falls token noch fehlt val userId =
principal?.userId ?: request.userId // Fallback auf request.userId, falls token noch fehlt
val currentSeconds = repository.getScreentime(userId) val currentSeconds = repository.getScreentime(userId)
var newSeconds = currentSeconds - request.usedSecondsSinceLastSync var newSeconds = currentSeconds - request.usedSecondsSinceLastSync
@ -217,4 +219,5 @@ fun Application.configureRouting(
} }
} }
} }
}