add top menu

This commit is contained in:
2026-03-26 13:22:10 +01:00
parent ca27cbea1c
commit c09e525736
10 changed files with 403 additions and 190 deletions

View File

@@ -25,6 +25,7 @@ func MenuHandlerRoutes(r fiber.Router) fiber.Router {
r.Get("/get-menu", handler.GetMenu)
r.Get("/get-routes", handler.GetRouting)
r.Get("/get-top-menu", handler.GetTopMenu)
return r
}
@@ -58,3 +59,18 @@ func (h *MenuHandler) GetRouting(c fiber.Ctx) error {
return c.JSON(response.Make(&menu, 0, i18n.T_(c, response.Message_OK)))
}
func (h *MenuHandler) GetTopMenu(c fiber.Ctx) error {
lang_id, ok := c.Locals("langID").(uint)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
menu, err := h.menuService.GetTopMenu(lang_id)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&menu, len(menu), i18n.T_(c, response.Message_OK)))
}