Sonar cleaning.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
aminecmi 2022-08-12 23:07:06 +02:00
parent 084643aab5
commit 77aa8421d8
2 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,4 @@
import dao.DB
import dao.ItemView
import dao.KeyView
import io.javalin.apibuilder.CrudHandler
import io.javalin.http.Context

View File

@ -12,6 +12,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
enum class ApiRole : Role { PUBLIC, BASIC_AUTHED, API_AUTHED }
fun main() {
val listIdStr = "list-id"
var migrationsController = MigrationsController()
val app = Javalin.create {
it.accessManager { handler, ctx, permittedRoles ->
@ -53,19 +54,19 @@ fun main() {
}, roles(ApiRole.PUBLIC))
get("/api/lists/:list-id/items", { ctx ->
ListItemsController().getListItems(ctx, ctx.pathParam("list-id"))
ListItemsController().getListItems(ctx, ctx.pathParam(listIdStr))
}, roles(ApiRole.API_AUTHED))
post("/api/lists/:list-id/items", { ctx ->
ListItemsController().create(ctx.pathParam("list-id"), ctx)
ListItemsController().create(ctx.pathParam(listIdStr), ctx)
}, roles(ApiRole.API_AUTHED))
delete("/api/lists/:list-id/items/:item-id", { ctx ->
ListItemsController().delete(ctx.pathParam("list-id"), ctx.pathParam("item-id"), ctx)
ListItemsController().delete(ctx.pathParam(listIdStr), ctx.pathParam("item-id"), ctx)
}, roles(ApiRole.API_AUTHED))
patch("/api/lists/:list-id/items/:item-id", { ctx ->
ListItemsController().update(ctx.pathParam("list-id"), ctx.pathParam("item-id"), ctx)
ListItemsController().update(ctx.pathParam(listIdStr), ctx.pathParam("item-id"), ctx)
}, roles(ApiRole.API_AUTHED))
}
}