mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'fix/daily-checklist' into 'development'
fix See merge request mbugroup/lti-api!223
This commit is contained in:
@@ -52,7 +52,7 @@ type SummaryQuery struct {
|
|||||||
|
|
||||||
type ReportQuery struct {
|
type ReportQuery struct {
|
||||||
Page int `query:"page" validate:"required,number,min=1,gt=0"`
|
Page int `query:"page" validate:"required,number,min=1,gt=0"`
|
||||||
Limit int `query:"limit" validate:"required,number,min=1,max=100,gt=0"`
|
Limit int `query:"limit" validate:"required,number,min=1,gt=0"`
|
||||||
Month int `query:"bulan" validate:"required,number,min=1,max=12"`
|
Month int `query:"bulan" validate:"required,number,min=1,max=12"`
|
||||||
Year int `query:"tahun" validate:"required,number,min=1900"`
|
Year int `query:"tahun" validate:"required,number,min=1900"`
|
||||||
AreaID *uint `query:"area_id" validate:"omitempty"`
|
AreaID *uint `query:"area_id" validate:"omitempty"`
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ func (s *configChecklistService) CreateOne(c *fiber.Ctx, req *validation.Create)
|
|||||||
if err := s.Validate.Struct(req); err != nil {
|
if err := s.Validate.Struct(req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.PercentageThresholdBad > req.PercentageThresholdEnough {
|
||||||
|
return nil, fiber.NewError(fiber.StatusBadRequest, "percentage_threshold_bad cannot be greater than percentage_threshold_enough")
|
||||||
|
}
|
||||||
|
|
||||||
date, err := time.Parse("2006-01-02", req.Date)
|
date, err := time.Parse("2006-01-02", req.Date)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -100,6 +103,11 @@ func (s configChecklistService) UpdateOne(c *fiber.Ctx, req *validation.Update,
|
|||||||
if err := s.Validate.Struct(req); err != nil {
|
if err := s.Validate.Struct(req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.PercentageThresholdBad != nil && req.PercentageThresholdEnough != nil {
|
||||||
|
if *req.PercentageThresholdBad > *req.PercentageThresholdEnough {
|
||||||
|
return nil, fiber.NewError(fiber.StatusBadRequest, "percentage_threshold_bad cannot be greater than percentage_threshold_enough")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateBody := make(map[string]any)
|
updateBody := make(map[string]any)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user