Skip to content

Commit

Permalink
CORE-2016: slight changes to the response body for the subscriptions …
Browse files Browse the repository at this point in the history
…endpoints
  • Loading branch information
slr71 committed Oct 31, 2024
1 parent fa43dc9 commit 266304a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions internal/db/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,15 @@ func GetSubscriptionDetails(ctx context.Context, db *gorm.DB, subscriptionID str
err := db.WithContext(ctx).
Preload("User").
Preload("Plan").
Preload("Plan.PlanQuotaDefaults").
Preload("Plan.PlanQuotaDefaults", func(db *gorm.DB) *gorm.DB {
return db.
Joins("INNER JOIN resource_types ON plan_quota_defaults.resource_type_id = resource_types.id").
Order("plan_quota_defaults.effective_date asc, resource_types.name asc")
}).
Preload("Plan.PlanQuotaDefaults.ResourceType").
Preload("Plan.PlanRates", func(db *gorm.DB) *gorm.DB {
return db.Order("effective_date asc")
}).
Preload("Quotas").
Preload("Quotas.ResourceType").
Preload("Usages").
Expand Down Expand Up @@ -212,8 +219,15 @@ func ListSubscriptions(ctx context.Context, db *gorm.DB, params *SubscriptionLis
Joins("JOIN users ON subscriptions.user_id=users.id").
Preload("User").
Preload("Plan").
Preload("Plan.PlanQuotaDefaults").
Preload("Plan.PlanQuotaDefaults", func(db *gorm.DB) *gorm.DB {
return db.
Joins("INNER JOIN resource_types ON plan_quota_defaults.resource_type_id = resource_types.id").
Order("plan_quota_defaults.effective_date asc, resource_types.name asc")
}).
Preload("Plan.PlanQuotaDefaults.ResourceType").
Preload("Plan.PlanRates", func(db *gorm.DB) *gorm.DB {
return db.Order("effective_date asc")
}).
Preload("Quotas").
Preload("Quotas.ResourceType").
Preload("Usages").
Expand Down

0 comments on commit 266304a

Please sign in to comment.