feat(uom): Enhance GetAll method to support 'get_all' query parameter for retrieving all UOMs
Deploy Application / deploy (push) Successful in 26s
Details
Deploy Application / deploy (push) Successful in 26s
Details
This commit is contained in:
parent
be318fe760
commit
cfe9cb4e77
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue