add command normalize data seed standar and price adjustment stocks

This commit is contained in:
giovanni
2026-04-20 00:03:59 +07:00
parent 30adbb6b8a
commit f98c73f569
8 changed files with 1031 additions and 7 deletions
+3 -3
View File
@@ -18,11 +18,11 @@ type DashboardModule struct{}
func (DashboardModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
dashboardRepo := rDashboard.NewDashboardRepository(db)
hppCostRepo := commonRepo.NewHppCostRepository(db)
hppV2CostRepo := commonRepo.NewHppV2CostRepository(db)
userRepo := rUser.NewUserRepository(db)
hppSvc := commonService.NewHppService(hppCostRepo)
dashboardService := sDashboard.NewDashboardService(dashboardRepo, validate, hppSvc)
hppV2Svc := commonService.NewHppV2Service(hppV2CostRepo)
dashboardService := sDashboard.NewDashboardService(dashboardRepo, validate, hppV2Svc)
userService := sUser.NewUserService(userRepo, validate)
DashboardRoutes(router, userService, dashboardService)
@@ -30,10 +30,10 @@ type dashboardService struct {
Log *logrus.Logger
Validate *validator.Validate
Repository repository.DashboardRepository
HppSvc commonService.HppService
HppSvc commonService.HppV2Service
}
func NewDashboardService(repo repository.DashboardRepository, validate *validator.Validate, hppSvc commonService.HppService) DashboardService {
func NewDashboardService(repo repository.DashboardRepository, validate *validator.Validate, hppSvc commonService.HppV2Service) DashboardService {
return &dashboardService{
Log: utils.Log,
Validate: validate,
@@ -773,7 +773,7 @@ func (s *repportService) GetMarketing(c *fiber.Ctx, params *validation.Marketing
return nil, 0, err
}
hppByDelivery := buildMarketingHppByDelivery(c.Context(), s.HppSvc, attributionRows)
hppByDelivery := buildMarketingHppByDelivery(c.Context(), s.HppV2Svc, attributionRows)
categoryByDelivery := buildMarketingCategoryByDelivery(deliveryProducts, attributionRows)
items := dto.ToMarketingReportItems(deliveryProducts, hppByDelivery, categoryByDelivery, agingMap)
@@ -782,7 +782,7 @@ func (s *repportService) GetMarketing(c *fiber.Ctx, params *validation.Marketing
func buildMarketingHppByDelivery(
ctx context.Context,
hppSvc approvalService.HppService,
hppSvc approvalService.HppV2Service,
attributionRows []commonRepo.MarketingDeliveryAttributionRow,
) map[uint]float64 {
if len(attributionRows) == 0 {