Add Filter Sales Metric

This commit is contained in:
aditya.siregar
2024-08-02 14:41:41 +07:00
parent 4e4d9d3a90
commit eff502b24a
5 changed files with 47 additions and 16 deletions
+5 -3
View File
@@ -282,9 +282,11 @@ func (h *Handler) toDailySales(resp []entity.ProductDailySales) []response.Produ
var dailySales []response.ProductDailySales
for _, b := range resp {
dailySales = append(dailySales, response.ProductDailySales{
Day: b.Day,
ProductID: b.ProductID,
TotalQuantity: b.TotalQuantity,
Day: b.Day,
SiteID: b.SiteID,
Total: b.Total,
SiteName: b.SiteName,
PaymentType: b.PaymentType,
})
}
return dailySales
+2
View File
@@ -19,6 +19,7 @@ type OrderParam struct {
Status string `form:"status" json:"status"`
Limit int `form:"limit" json:"limit" example:"10"`
Offset int `form:"offset" json:"offset" example:"0"`
Period string `form:"period" json:"period" example:"1d,7d,1m"`
}
func (o *OrderParam) ToOrderEntity(ctx mycontext.Context) entity.OrderSearch {
@@ -32,6 +33,7 @@ func (o *OrderParam) ToOrderEntity(ctx mycontext.Context) entity.OrderSearch {
StartDate: o.StartDate,
EndDate: o.EndDate,
Status: o.Status,
Period: o.Period,
}
}
+5 -3
View File
@@ -113,7 +113,9 @@ type CreateOrderItemResponse struct {
}
type ProductDailySales struct {
Day time.Time
ProductID int64
TotalQuantity int
Day time.Time `json:"day"`
SiteID int64 `json:"site_id"`
SiteName string `json:"site_name"`
PaymentType string `json:"payment_type"`
Total float64 `json:"total"`
}