🔧 Fixes status pages
This commit is contained in:
@@ -5,6 +5,7 @@ import dev.svitan.schemas.NewAuthDTO
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.application.Application
|
||||
import io.ktor.server.auth.authentication
|
||||
import io.ktor.server.plugins.BadRequestException
|
||||
import io.ktor.server.plugins.NotFoundException
|
||||
import io.ktor.server.request.receive
|
||||
import io.ktor.server.response.respond
|
||||
@@ -24,14 +25,14 @@ fun Application.routeAuth() {
|
||||
}
|
||||
|
||||
get("/auth/{id}") {
|
||||
val idRaw = call.parameters["id"] ?: throw IllegalArgumentException("Invalid id")
|
||||
val idRaw = call.parameters["id"] ?: throw BadRequestException("Invalid id")
|
||||
val id = UUID.fromString(idRaw)
|
||||
val auth = AuthService.read(id) ?: throw NotFoundException()
|
||||
call.respond(auth)
|
||||
}
|
||||
|
||||
delete("/auth/{id}") {
|
||||
val idRaw = call.parameters["id"] ?: throw IllegalArgumentException("Invalid id")
|
||||
val idRaw = call.parameters["id"] ?: throw BadRequestException("Invalid id")
|
||||
val id = UUID.fromString(idRaw)
|
||||
AuthService.delete(id)
|
||||
call.respond(HttpStatusCode.NoContent)
|
||||
|
||||
Reference in New Issue
Block a user