Feat[BE-222]: Completed SO and DO API

This commit is contained in:
aguhh18
2025-11-17 07:16:07 +07:00
parent 903b114315
commit 7905bdb0d7
16 changed files with 600 additions and 1011 deletions
@@ -39,7 +39,7 @@ func (u *DeliveryOrdersController) GetAll(c *fiber.Ctx) error {
}
return c.Status(fiber.StatusOK).
JSON(response.SuccessWithPaginate[dto.DeliveryOrdersListDTO]{
JSON(response.SuccessWithPaginate[dto.MarketingListDTO]{
Code: fiber.StatusOK,
Status: "success",
Message: "Get all deliveryOrderss successfully",
@@ -122,44 +122,3 @@ func (u *DeliveryOrdersController) UpdateOne(c *fiber.Ctx) error {
Data: result,
})
}
func (u *DeliveryOrdersController) DeleteOne(c *fiber.Ctx) error {
param := c.Params("id")
id, err := strconv.Atoi(param)
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, "Invalid Id")
}
if err := u.DeliveryOrdersService.DeleteOne(c, uint(id)); err != nil {
return err
}
return c.Status(fiber.StatusOK).
JSON(response.Common{
Code: fiber.StatusOK,
Status: "success",
Message: "Delete deliveryOrders successfully",
})
}
func (u *DeliveryOrdersController) Approval(c *fiber.Ctx) error {
req := new(validation.Approve)
if err := c.BodyParser(req); err != nil {
return fiber.NewError(fiber.StatusBadRequest, "Invalid request body")
}
results, err := u.DeliveryOrdersService.Approval(c, req)
if err != nil {
return err
}
return c.Status(fiber.StatusOK).
JSON(response.Success{
Code: fiber.StatusOK,
Status: "success",
Message: "Submit delivery order approval successfully",
Data: results,
})
}