mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 02:52:53 +00:00
refactor: Replace unused context parameters with blank identifiers and fix variable references
- Replace ctx parameter with _ in provisionTenantContext, provisionDatabaseSchema, provisionStorageResources, configureCarrier, configureRatePlans, setupPaymentProcessing, and validateCompliance methods - Fix tenant_id scope to use wrappedTx.tenantID instead of r.tenantID in TenantScopedTransaction - Fix pricing effectiveness analytics to use ratePlanAnalytics.AverageDiscount and ratePlanAnalytics.TotalSavings instead of analytics.
This commit is contained in:
@@ -88,19 +88,19 @@ func (p *MVNOProvisioner) SetupAPIAccess(ctx context.Context, mvno *MVNO) error
|
||||
}
|
||||
|
||||
// provisionTenantContext creates tenant context
|
||||
func (p *MVNOProvisioner) provisionTenantContext(ctx context.Context, mvno *MVNO) error {
|
||||
func (p *MVNOProvisioner) provisionTenantContext(_ context.Context, mvno *MVNO) error {
|
||||
p.logger.WithField("mvno_id", mvno.ID).Info("Tenant context provisioned")
|
||||
return nil
|
||||
}
|
||||
|
||||
// provisionDatabaseSchema provisions database schema
|
||||
func (p *MVNOProvisioner) provisionDatabaseSchema(ctx context.Context, mvno *MVNO) error {
|
||||
func (p *MVNOProvisioner) provisionDatabaseSchema(_ context.Context, mvno *MVNO) error {
|
||||
p.logger.WithField("mvno_id", mvno.ID).Info("Database schema provisioned")
|
||||
return nil
|
||||
}
|
||||
|
||||
// provisionStorageResources provisions storage resources
|
||||
func (p *MVNOProvisioner) provisionStorageResources(ctx context.Context, mvno *MVNO) error {
|
||||
func (p *MVNOProvisioner) provisionStorageResources(_ context.Context, mvno *MVNO) error {
|
||||
storageSize := p.getStorageAllocation(mvno.Plan)
|
||||
p.logger.WithFields(map[string]any{
|
||||
"mvno_id": mvno.ID,
|
||||
@@ -125,7 +125,7 @@ func (p *MVNOProvisioner) selectCarriers(countries []string) ([]string, error) {
|
||||
}
|
||||
|
||||
// configureCarrier configures individual carrier
|
||||
func (p *MVNOProvisioner) configureCarrier(ctx context.Context, mvno *MVNO, carrierID string) error {
|
||||
func (p *MVNOProvisioner) configureCarrier(_ context.Context, mvno *MVNO, carrierID string) error {
|
||||
p.logger.WithFields(map[string]any{
|
||||
"mvno_id": mvno.ID,
|
||||
"carrier_id": carrierID,
|
||||
@@ -134,7 +134,7 @@ func (p *MVNOProvisioner) configureCarrier(ctx context.Context, mvno *MVNO, carr
|
||||
}
|
||||
|
||||
// configureRatePlans configures rate plans
|
||||
func (p *MVNOProvisioner) configureRatePlans(ctx context.Context, mvno *MVNO, billingID string) error {
|
||||
func (p *MVNOProvisioner) configureRatePlans(_ context.Context, mvno *MVNO, billingID string) error {
|
||||
p.logger.WithFields(map[string]any{
|
||||
"mvno_id": mvno.ID,
|
||||
"billing_id": billingID,
|
||||
@@ -144,7 +144,7 @@ func (p *MVNOProvisioner) configureRatePlans(ctx context.Context, mvno *MVNO, bi
|
||||
}
|
||||
|
||||
// setupPaymentProcessing setup payment processing
|
||||
func (p *MVNOProvisioner) setupPaymentProcessing(ctx context.Context, mvno *MVNO, billingID string) error {
|
||||
func (p *MVNOProvisioner) setupPaymentProcessing(_ context.Context, mvno *MVNO, billingID string) error {
|
||||
p.logger.WithFields(map[string]any{
|
||||
"mvno_id": mvno.ID,
|
||||
"billing_id": billingID,
|
||||
|
||||
@@ -136,7 +136,7 @@ func (v *OnboardingValidator) validateBusinessRegistration(businessID string) er
|
||||
}
|
||||
|
||||
// validateCompliance validates regulatory compliance
|
||||
func (v *OnboardingValidator) validateCompliance(ctx context.Context, mvno *MVNO) error {
|
||||
func (v *OnboardingValidator) validateCompliance(_ context.Context, mvno *MVNO) error {
|
||||
// Check regulatory compliance for target countries
|
||||
for _, country := range mvno.Config.AllowedCountries {
|
||||
if err := v.checkCountryCompliance(country); err != nil {
|
||||
|
||||
@@ -80,7 +80,7 @@ func (r *TenantAwareRepository) TenantScopedTransaction(ctx context.Context, fn
|
||||
// Since the function expects *gorm.DB, we need to embed the wrapper properly
|
||||
return fn(wrappedTx.DB.Scopes(func(db *gorm.DB) *gorm.DB {
|
||||
// Apply tenant filtering to all queries
|
||||
return db.Where("tenant_id = ?", r.tenantID)
|
||||
return db.Where("tenant_id = ?", wrappedTx.tenantID)
|
||||
}))
|
||||
}
|
||||
return fn(tx)
|
||||
|
||||
@@ -172,8 +172,8 @@ func (pi *PricingIntegration) GetPricingEffectiveness(ctx context.Context, tenan
|
||||
ActiveRules: analytics.ActiveRules,
|
||||
TotalRatePlans: ratePlanAnalytics.TotalRatePlans,
|
||||
PlansWithPricing: ratePlanAnalytics.PlansWithPricing,
|
||||
AverageDiscountRate: analytics.DiscountStats.AverageDiscount,
|
||||
TotalSavings: analytics.DiscountStats.TotalDiscountValue,
|
||||
AverageDiscountRate: ratePlanAnalytics.AverageDiscount,
|
||||
TotalSavings: ratePlanAnalytics.TotalSavings,
|
||||
RulesByType: analytics.RulesByType,
|
||||
ConversionImprovement: ratePlanAnalytics.ConversionRate,
|
||||
GeneratedAt: id.GetCurrentTime(),
|
||||
|
||||
@@ -154,18 +154,3 @@ func (m *SMDPManager) updateCarrierMetrics(carrierID string, success bool, respo
|
||||
|
||||
carrier.Metrics.RequestRate = float64(carrier.Metrics.TotalRequests) / time.Since(time.Now().Add(-time.Minute)).Seconds()
|
||||
}
|
||||
|
||||
func (m *SMDPManager) getHighestPriorityCarrier(carriers []*Carrier) *Carrier {
|
||||
if len(carriers) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
highestPriority := carriers[0]
|
||||
for _, carrier := range carriers {
|
||||
if carrier.Priority > highestPriority.Priority {
|
||||
highestPriority = carrier
|
||||
}
|
||||
}
|
||||
|
||||
return highestPriority
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user