This commit is contained in:
2026-05-01 19:11:08 +03:00
parent c801783779
commit f39d9ff11e
2 changed files with 7 additions and 4 deletions

View File

@@ -418,7 +418,7 @@ public class MainVerticle extends AbstractVerticle {
.onFailure(err -> rc.response().setStatusCode(500).end(err.getMessage())); .onFailure(err -> rc.response().setStatusCode(500).end(err.getMessage()));
}); });
new IikoHandler(vertx, router, db, restaurantService); new IikoHandler(vertx, router, db, restaurantService, authHandler);
return router; return router;
} }

View File

@@ -10,6 +10,8 @@ import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.Tuple; import io.vertx.sqlclient.Tuple;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import su.xserver.iikocon.handler.AdminHandler;
import su.xserver.iikocon.handler.AuthHandler;
import su.xserver.iikocon.service.DataBaseService; import su.xserver.iikocon.service.DataBaseService;
import su.xserver.iikocon.service.RestaurantService; import su.xserver.iikocon.service.RestaurantService;
@@ -20,7 +22,7 @@ public class IikoHandler {
private final Vertx vertx; private final Vertx vertx;
private final RestaurantService restaurantService; private final RestaurantService restaurantService;
public IikoHandler(Vertx vertx, Router router, DataBaseService db, RestaurantService restaurantService) { public IikoHandler(Vertx vertx, Router router, DataBaseService db, RestaurantService restaurantService, AuthHandler authHandler) {
this.vertx = vertx; this.vertx = vertx;
this.restaurantService = restaurantService; this.restaurantService = restaurantService;
this.db = db; this.db = db;
@@ -29,9 +31,10 @@ public class IikoHandler {
log.error("Failed to initialize database", err); log.error("Failed to initialize database", err);
}); });
router.route("/api/reports/olap/*").handler(authHandler::requireAuth);
router.get("/api/reports/olap/columns").handler(this::getColumns); router.get("/api/reports/olap/columns").handler(this::getColumns);
router.delete("/api/reports/olap/columns/:fieldKey").handler(this::deleteColumn); router.delete("/api/reports/olap/columns/:fieldKey").handler(AdminHandler::requireAdmin).handler(this::deleteColumn);
router.post("/api/reports/olap/initialize").handler(this::postInitialize); router.post("/api/reports/olap/initialize").handler(AdminHandler::requireAdmin).handler(this::postInitialize);
} }
private void getColumns(RoutingContext ctx) { private void getColumns(RoutingContext ctx) {