mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
add validate query param
This commit is contained in:
@@ -3373,6 +3373,16 @@ func (s *repportService) parseHppPerFarmQuery(ctx *fiber.Ctx) (*validation.HppPe
|
|||||||
startDate := ctx.Query("start_date", "")
|
startDate := ctx.Query("start_date", "")
|
||||||
endDate := ctx.Query("end_date", "")
|
endDate := ctx.Query("end_date", "")
|
||||||
|
|
||||||
|
if strings.TrimSpace(startDate) == "" {
|
||||||
|
return nil, dto.HppPerFarmFiltersDTO{}, fiber.NewError(fiber.StatusBadRequest, "start_date is required")
|
||||||
|
}
|
||||||
|
if strings.TrimSpace(endDate) == "" {
|
||||||
|
return nil, dto.HppPerFarmFiltersDTO{}, fiber.NewError(fiber.StatusBadRequest, "end_date is required")
|
||||||
|
}
|
||||||
|
if strings.TrimSpace(rawLocation) == "" {
|
||||||
|
return nil, dto.HppPerFarmFiltersDTO{}, fiber.NewError(fiber.StatusBadRequest, "location_id is required")
|
||||||
|
}
|
||||||
|
|
||||||
areaIDs, err := parseCommaSeparatedInt64s(rawArea)
|
areaIDs, err := parseCommaSeparatedInt64s(rawArea)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, dto.HppPerFarmFiltersDTO{}, fiber.NewError(fiber.StatusBadRequest, err.Error())
|
return nil, dto.HppPerFarmFiltersDTO{}, fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user