mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-25 07:45:44 +00:00
Feat(BE-334): make reporting closing hpp for project_flock_kandang
This commit is contained in:
@@ -251,7 +251,7 @@ func (u *ClosingController) GetExpeditionHPP(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
projectFlockID, err := strconv.Atoi(param)
|
projectFlockID, err := strconv.Atoi(param)
|
||||||
if err != nil || projectFlockID <= 0 {
|
if err != nil || projectFlockID <= 0 {
|
||||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid Project Flock Id")
|
return fiber.NewError(fiber.StatusBadRequest, "Invalid project_flock_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
var projectFlockKandangID *uint
|
var projectFlockKandangID *uint
|
||||||
@@ -277,3 +277,33 @@ func (u *ClosingController) GetExpeditionHPP(c *fiber.Ctx) error {
|
|||||||
Data: result,
|
Data: result,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *ClosingController) GetExpeditionHPPByKandang(c *fiber.Ctx) error {
|
||||||
|
projectParam := c.Params("project_flock_id")
|
||||||
|
kandangParam := c.Params("project_flock_kandang_id")
|
||||||
|
|
||||||
|
projectFlockID, err := strconv.Atoi(projectParam)
|
||||||
|
if err != nil || projectFlockID <= 0 {
|
||||||
|
return fiber.NewError(fiber.StatusBadRequest, "Invalid project_flock_id")
|
||||||
|
}
|
||||||
|
|
||||||
|
pfkID, err := strconv.Atoi(kandangParam)
|
||||||
|
if err != nil || pfkID <= 0 {
|
||||||
|
return fiber.NewError(fiber.StatusBadRequest, "Invalid project_flock_kandang_id")
|
||||||
|
}
|
||||||
|
|
||||||
|
kandangID := uint(pfkID)
|
||||||
|
|
||||||
|
result, err := u.ClosingService.GetExpeditionHPP(c, uint(projectFlockID), &kandangID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Status(fiber.StatusOK).
|
||||||
|
JSON(response.Success{
|
||||||
|
Code: fiber.StatusOK,
|
||||||
|
Status: "success",
|
||||||
|
Message: "Get expedition HPP successfully",
|
||||||
|
Data: result,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,4 +28,5 @@ func ClosingRoutes(v1 fiber.Router, u user.UserService, s closing.ClosingService
|
|||||||
route.Get("/:projectFlockId", ctrl.GetClosingSummary)
|
route.Get("/:projectFlockId", ctrl.GetClosingSummary)
|
||||||
route.Get("/:projectFlockId/sapronak", ctrl.GetClosingSapronak)
|
route.Get("/:projectFlockId/sapronak", ctrl.GetClosingSapronak)
|
||||||
route.Get("/:project_flock_id/expedition-hpp", ctrl.GetExpeditionHPP)
|
route.Get("/:project_flock_id/expedition-hpp", ctrl.GetExpeditionHPP)
|
||||||
|
route.Get("/:project_flock_id/:project_flock_kandang_id/expedition-hpp", ctrl.GetExpeditionHPPByKandang)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user