reinstate profit loss overview

This commit is contained in:
2026-06-01 13:13:40 +07:00
parent dc13bb5f93
commit 47fa21d739
10 changed files with 541 additions and 25 deletions
+12 -12
View File
@@ -134,18 +134,6 @@ func (s *AnalyticsServiceImpl) validatePaymentMethodAnalyticsRequest(req *models
return fmt.Errorf("date_from cannot be after date_to")
}
if req.GroupBy != "" {
validGroupBy := map[string]bool{
"day": true,
"hour": true,
"week": true,
"month": true,
}
if !validGroupBy[req.GroupBy] {
return fmt.Errorf("invalid group_by value: %s", req.GroupBy)
}
}
return nil
}
@@ -318,5 +306,17 @@ func (s *AnalyticsServiceImpl) validateProfitLossAnalyticsRequest(req *models.Pr
return fmt.Errorf("date_from cannot be after date_to")
}
if req.GroupBy != "" {
validGroupBy := map[string]bool{
"day": true,
"hour": true,
"week": true,
"month": true,
}
if !validGroupBy[req.GroupBy] {
return fmt.Errorf("invalid group_by value: %s", req.GroupBy)
}
}
return nil
}