feat: Fix type conversions, rename ExchangeRateProvider to RateProviderType, and improve currency integration

- Fix GetRevenueAnalytics return type by dereferencing metrics struct
- Fix getCarrierMetrics to use int64 for Count and convert to int for ActiveCarriers
- Rename ExchangeRateProvider to RateProviderType for consistency
- Change RatePlanCurrencyIntegrator.exchangeService from pointer to interface type
- Add function documentation comments for NewRatePlanCurrencyIntegrator, SubscribeToPlanWith
This commit is contained in:
nutcas3
2026-05-03 10:52:29 +03:00
parent 79fa56f25d
commit c6fccc893d
3 changed files with 49 additions and 32 deletions
@@ -64,7 +64,8 @@ func (s *Service) GetDashboard(ctx context.Context, filter *AnalyticsFilter) (*D
// GetRevenueAnalytics retrieves detailed revenue analytics
func (s *Service) GetRevenueAnalytics(ctx context.Context, filter *AnalyticsFilter) (*RevenueMetrics, error) {
return s.getRevenueMetrics(ctx, filter)
metrics, err := s.getRevenueMetrics(ctx, filter)
return &metrics, err
}
func (s *Service) getRevenueMetrics(ctx context.Context, filter *AnalyticsFilter) (RevenueMetrics, error) {
@@ -141,9 +142,11 @@ func (s *Service) getCarrierMetrics(ctx context.Context, filter *AnalyticsFilter
}
// Query carrier stats
var activeCount int64
s.db.WithContext(ctx).Table("carriers").
Where("is_active = ?", true).
Count((*int64)(&metrics.ActiveCarriers))
Count(&activeCount)
metrics.ActiveCarriers = int(activeCount)
return metrics, nil
}