From 77aa8421d8f76527a01bddcd9f97d2048a93ab9d Mon Sep 17 00:00:00 2001 From: aminecmi Date: Fri, 12 Aug 2022 23:07:06 +0200 Subject: [PATCH] Sonar cleaning. --- src/main/kotlin/KeysController.kt | 2 -- src/main/kotlin/server.kt | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/KeysController.kt b/src/main/kotlin/KeysController.kt index 0fba188..aef6d55 100644 --- a/src/main/kotlin/KeysController.kt +++ b/src/main/kotlin/KeysController.kt @@ -1,6 +1,4 @@ import dao.DB -import dao.ItemView -import dao.KeyView import io.javalin.apibuilder.CrudHandler import io.javalin.http.Context diff --git a/src/main/kotlin/server.kt b/src/main/kotlin/server.kt index 0b187d6..6082320 100644 --- a/src/main/kotlin/server.kt +++ b/src/main/kotlin/server.kt @@ -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)) } } \ No newline at end of file