Skip to content

Commit

Permalink
bug: retry feature pull with backoff + add missing fields from org su…
Browse files Browse the repository at this point in the history
…bscriptions (#372)

* bug: retry feature pull with backoff

Signed-off-by: Sarah Funkhouser <[email protected]>

* linter

Signed-off-by: Sarah Funkhouser <[email protected]>

* bug: fix missing operation context when not a graph request

Signed-off-by: Sarah Funkhouser <[email protected]>

* feat: add missing fields, fix subscriptionURL bug

Signed-off-by: Sarah Funkhouser <[email protected]>

* linter

Signed-off-by: Sarah Funkhouser <[email protected]>

* move check to function

Signed-off-by: Sarah Funkhouser <[email protected]>

---------

Signed-off-by: Sarah Funkhouser <[email protected]>
  • Loading branch information
golanglemonade authored Jan 10, 2025
1 parent fe5f729 commit de8b7ce
Show file tree
Hide file tree
Showing 45 changed files with 901 additions and 92 deletions.
10 changes: 8 additions & 2 deletions cmd/cli/cmd/orgsubscription/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ func jsonOutput(out any) error {
// tableOutput prints the output in a table format
func tableOutput(out []openlaneclient.OrgSubscription) {
// create a table writer
// TODO: add additional columns to the table writer
writer := tables.NewTableWriter(command.OutOrStdout(), "ID", "StripeCustomerID", "StripeSubscriptionStatus", "ProductTier", "Features", "ExpiresAt")
writer := tables.NewTableWriter(command.OutOrStdout(), "ID", "Active", "StripeCustomerID", "StripeSubscriptionStatus", "ProductTier", "Features", "Price", "ExpiresAt")
for _, i := range out {
features := []string{}
if i.Features != nil {
Expand All @@ -94,11 +93,18 @@ func tableOutput(out []openlaneclient.OrgSubscription) {
exp = i.ExpiresAt.String()
}

price := ""
if i.ProductPrice != nil {
price = i.ProductPrice.String()
}

writer.AddRow(i.ID,
i.Active,
*i.StripeCustomerID,
*i.StripeSubscriptionStatus,
*i.ProductTier,
strings.Join(features, ", "),
price,
exp,
)
}
Expand Down
11 changes: 11 additions & 0 deletions db/migrations-goose-postgres/20250110162830_subscription_price.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- +goose Up
-- modify "org_subscription_history" table
ALTER TABLE "org_subscription_history" ADD COLUMN "product_price" jsonb NULL;
-- modify "org_subscriptions" table
ALTER TABLE "org_subscriptions" ADD COLUMN "product_price" jsonb NULL;

-- +goose Down
-- reverse: modify "org_subscriptions" table
ALTER TABLE "org_subscriptions" DROP COLUMN "product_price";
-- reverse: modify "org_subscription_history" table
ALTER TABLE "org_subscription_history" DROP COLUMN "product_price";
3 changes: 2 additions & 1 deletion db/migrations-goose-postgres/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
h1:QXCrkYR4vxggy2Kk14xhgOkCom8B/+rl+I7Rgzroh0k=
h1:TRyOA0hBgJWu/ryMtc4bGT7xQ4ZM7obgNDeGGFkC+No=
20241211231032_init.sql h1:Cj6GduEDECy6Y+8DfI6767WosqG2AKWybIyJJ6AgKqA=
20241212223714_consistent_naming.sql h1:RvnNmsStlHkmAdSCnX1fFh/KYgfj1RMYYEc4iCN9JcQ=
20250109002850_billing_address.sql h1:m0ek3WXqRgS3+ZbSa/DcIMB16vb8Tjm2MgNqyRll3rU=
20250109054654_remove_stripe_id.sql h1:OfeshKT2+ydfx+36e4uBrdQ31tuurcJsKXyYDp1ZiZg=
20250110162830_subscription_price.sql h1:ju8ocKPbqtOalaBZ1aGk8qCDLbgxFCDoA0Dmkr9bLzA=
4 changes: 4 additions & 0 deletions db/migrations/20250110162828_subscription_price.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Modify "org_subscription_history" table
ALTER TABLE "org_subscription_history" ADD COLUMN "product_price" jsonb NULL;
-- Modify "org_subscriptions" table
ALTER TABLE "org_subscriptions" ADD COLUMN "product_price" jsonb NULL;
3 changes: 2 additions & 1 deletion db/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
h1:8AGIgzcKy+aGOwhLSJk/xgL6kfmXBArWQGmrkTdVur4=
h1:erRnNniAqlfYXxANR5MxeFGdCDzegYYF35eOGuZi0Fg=
20241211231032_init.sql h1:TxjpHzKPB/5L2i7V2JfO1y+Cep/AyQN5wGjhY7saCeE=
20241212223712_consistent_naming.sql h1:tbdYOtixhW66Jmvy3aCm+X6neI/SRVvItKM0Bdn26TA=
20250109002849_billing_address.sql h1:mspCGbJ6HVmx3r4j+d/WvruzirJdJ8u5x18WF9R9ESE=
20250109054653_remove_stripe_id.sql h1:dB086/w/Ws7ZK8OvbRWX7ejN4HfizCKxcE3q/+Jv4U8=
20250110162828_subscription_price.sql h1:RlvrTtH6+PIFuJ+Fp5S06w0ho3B2O/Nn6QcWqSHLWEA=
3 changes: 3 additions & 0 deletions internal/ent/generated/auditing.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions internal/ent/generated/entql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions internal/ent/generated/gql_collection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions internal/ent/generated/history_from_mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion internal/ent/generated/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit de8b7ce

Please sign in to comment.