mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-13 07:25:13 +00:00
feat: Replace interface{} with any type alias for improved code clarity
- Remove omitempty from Plan field in Subscriber model
- Update NotifySubscriberUpdate to use any instead of interface{}
- Update sendDeactivationRequest parameter type from interface{} to any
This commit is contained in:
@@ -34,7 +34,7 @@ type Subscriber struct {
|
|||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||||
|
|
||||||
Plan ServicePlan `json:"plan,omitempty" gorm:"foreignKey:PlanID"`
|
Plan ServicePlan `json:"plan" gorm:"foreignKey:PlanID"`
|
||||||
Sessions []Session `json:"sessions,omitempty" gorm:"foreignKey:SubscriberID"`
|
Sessions []Session `json:"sessions,omitempty" gorm:"foreignKey:SubscriberID"`
|
||||||
UsageRecords []UsageRecord `json:"usage_records,omitempty" gorm:"foreignKey:SubscriberID"`
|
UsageRecords []UsageRecord `json:"usage_records,omitempty" gorm:"foreignKey:SubscriberID"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ func (a *AMFClient) TerminateSession(ctx context.Context, imsi models.IMSI, reas
|
|||||||
|
|
||||||
// NotifySubscriberUpdate notifies AMF of subscriber status changes
|
// NotifySubscriberUpdate notifies AMF of subscriber status changes
|
||||||
func (a *AMFClient) NotifySubscriberUpdate(ctx context.Context, imsi models.IMSI, status models.SubscriberStatus) error {
|
func (a *AMFClient) NotifySubscriberUpdate(ctx context.Context, imsi models.IMSI, status models.SubscriberStatus) error {
|
||||||
req := map[string]interface{}{
|
req := map[string]any{
|
||||||
"imsi": imsi,
|
"imsi": imsi,
|
||||||
"status": status,
|
"status": status,
|
||||||
"timestamp": time.Now(),
|
"timestamp": time.Now(),
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ func (e *ES2Service) sendActivationRequest(ctx context.Context, req ActivationRe
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *ES2Service) sendDeactivationRequest(ctx context.Context, req interface{}) error {
|
func (e *ES2Service) sendDeactivationRequest(ctx context.Context, req any) error {
|
||||||
jsonData, err := json.Marshal(req)
|
jsonData, err := json.Marshal(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to marshal deactivation request: %w", err)
|
return fmt.Errorf("failed to marshal deactivation request: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user