mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix: getAll and update response
This commit is contained in:
@@ -3,6 +3,7 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
service "gitlab.com/mbugroup/lti-api.git/internal/modules/system-settings/services"
|
service "gitlab.com/mbugroup/lti-api.git/internal/modules/system-settings/services"
|
||||||
|
"gitlab.com/mbugroup/lti-api.git/internal/response"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SystemSettingController struct {
|
type SystemSettingController struct {
|
||||||
@@ -18,7 +19,12 @@ func (ctrl *SystemSettingController) GetAll(c *fiber.Ctx) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.Status(fiber.StatusOK).JSON(fiber.Map{"data": settings})
|
return c.Status(fiber.StatusOK).JSON(response.Success{
|
||||||
|
Code: fiber.StatusOK,
|
||||||
|
Status: "success",
|
||||||
|
Message: "Get all system settings successfully",
|
||||||
|
Data: settings,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type setAllowNegativePakanOVKRequest struct {
|
type setAllowNegativePakanOVKRequest struct {
|
||||||
@@ -33,8 +39,9 @@ func (ctrl *SystemSettingController) SetAllowNegativePakanOVK(c *fiber.Ctx) erro
|
|||||||
if err := ctrl.Service.SetAllowNegativePakanOVK(c.Context(), req.Value); err != nil {
|
if err := ctrl.Service.SetAllowNegativePakanOVK(c.Context(), req.Value); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.Status(fiber.StatusOK).JSON(fiber.Map{
|
return c.Status(fiber.StatusOK).JSON(response.Common{
|
||||||
"message": "Setting berhasil diperbarui",
|
Code: fiber.StatusOK,
|
||||||
"value": req.Value,
|
Status: "success",
|
||||||
|
Message: "Setting berhasil diperbarui",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user