mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-12-06 10:28:47 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user