fix
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"eslogad-be/internal/appcontext"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -200,6 +201,28 @@ func (h *AdminApprovalFlowHandler) ListApprovalFlows(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, contract.BuildSuccessResponse(resp))
|
||||
}
|
||||
|
||||
func (h *AdminApprovalFlowHandler) ListApprovalFlowsByDepartment(c *gin.Context) {
|
||||
appCtx := appcontext.FromGinContext(c.Request.Context())
|
||||
|
||||
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "10"))
|
||||
offset := (page - 1) * limit
|
||||
|
||||
req := &contract.ListApprovalFlowsRequest{
|
||||
Limit: limit,
|
||||
Offset: offset,
|
||||
DepartmentID: &appCtx.DepartmentID,
|
||||
}
|
||||
|
||||
resp, err := h.svc.ListApprovalFlows(c.Request.Context(), req)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, &contract.ErrorResponse{Error: err.Error(), Code: http.StatusInternalServerError})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, contract.BuildSuccessResponse(resp))
|
||||
}
|
||||
|
||||
func (h *AdminApprovalFlowHandler) ActivateApprovalFlow(c *gin.Context) {
|
||||
id, err := uuid.Parse(c.Param("id"))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user