feat(uom): Enhance GetAll method to support 'get_all' query parameter for retrieving all UOMs
Deploy Application / deploy (push) Successful in 26s Details

This commit is contained in:
Habib Fatkhul Rohman 2025-11-14 14:51:22 +07:00
parent be318fe760
commit cfe9cb4e77
1 changed files with 14 additions and 0 deletions

View File

@ -101,6 +101,20 @@ func (c *uomController) GetAll(ctx *gin.Context) {
ctx.JSON(http.StatusBadRequest, res) ctx.JSON(http.StatusBadRequest, res)
return return
} }
getAll := ctx.Query("get_all")
if getAll != "" {
uoms, _, err := c.uomService.GetAll(ctx, filter)
if err != nil {
res := utils.BuildResponseFailed(dtodomain.MESSAGE_FAILED_GET_UOM, err.Error(), nil)
ctx.JSON(http.StatusBadRequest, res)
return
}
response := utils.BuildResponseSuccess(dtodomain.MESSAGE_SUCCESS_GET_UOM, uoms)
ctx.JSON(http.StatusOK, response)
return
}
perPage := utils.ParseInt(ctx.DefaultQuery("per_page", "10")) perPage := utils.ParseInt(ctx.DefaultQuery("per_page", "10"))
page := utils.ParseInt(ctx.DefaultQuery("page", "1")) page := utils.ParseInt(ctx.DefaultQuery("page", "1"))
filter.PerPage = perPage filter.PerPage = perPage