-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Add is___plan fields to plan resolver #1039
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
| type Plan { | ||
| trialStatus: TrialStatus! | ||
| trialStartDate: DateTime | ||
| trialEndDate: DateTime | ||
| trialTotalDays: Int | ||
| pretrialUsersCount: Int | ||
| baseUnitPrice: Int! | ||
| benefits: [String!]! | ||
| billingRate: String | ||
| hasSeatsLeft: Boolean! | ||
| isEnterprisePlan: Boolean! | ||
| isFreePlan: Boolean! | ||
| isProPlan: Boolean! | ||
| isSentryPlan: Boolean! | ||
| isTeamPlan: Boolean! | ||
| isTrialPlan: Boolean! | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How are all these boolean fields different from using a enum for plan name?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple aspects to it; first being there are multiple pro / sentry / team / enterprise / free plans so we can't rely on just the name of the plan to uniquely identify the plan type Secondly, we could use the 'tier name' attribute, and I was thinking about that route as well, but then in the gazebo code instead of having something like BEFORE AFTER POTENTIAL AFTER which then kind of leaves us in a similar situation as currently where we have some business logic in the FE. I could go either way tbh, I was just slightly leaning toward keeping gazebo more presentational
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok got it
does this mean multiple of these |
||
| marketingName: String! | ||
| monthlyUploadLimit: Int | ||
| planName: String! | ||
| @deprecated( | ||
| reason: "Plan representations have used `value` for a while, making the frontend code hard to change" | ||
| ) | ||
| value: String! | ||
| tierName: String! | ||
| billingRate: String | ||
| baseUnitPrice: Int! | ||
| benefits: [String!]! | ||
| monthlyUploadLimit: Int | ||
| planUserCount: Int | ||
| hasSeatsLeft: Boolean! | ||
| pretrialUsersCount: Int | ||
| tierName: String! | ||
| trialEndDate: DateTime | ||
| trialStartDate: DateTime | ||
| trialStatus: TrialStatus! | ||
| trialTotalDays: Int | ||
| value: String! | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,7 @@ | |
| from typing import List, Optional | ||
|
|
||
| from ariadne import ObjectType | ||
| from shared.plan.constants import ( | ||
| TrialStatus, | ||
| ) | ||
| from shared.plan.constants import PlanBillingRate, TrialStatus | ||
| from shared.plan.service import PlanService | ||
|
|
||
| from codecov.db import sync_to_async | ||
|
|
@@ -59,7 +57,7 @@ def resolve_tier_name(plan_service: PlanService, info) -> str: | |
|
|
||
| @plan_bindable.field("billingRate") | ||
| @sync_to_async | ||
| def resolve_billing_rate(plan_service: PlanService, info) -> Optional[str]: | ||
| def resolve_billing_rate(plan_service: PlanService, info) -> Optional[PlanBillingRate]: | ||
| return plan_service.billing_rate | ||
|
|
||
|
|
||
|
|
@@ -98,3 +96,39 @@ def resolve_plan_user_count(plan_service: PlanService, info) -> int: | |
| @sync_to_async | ||
| def resolve_has_seats_left(plan_service: PlanService, info) -> bool: | ||
| return plan_service.has_seats_left | ||
|
|
||
|
|
||
| @plan_bindable.field("isEnterprisePlan") | ||
| @sync_to_async | ||
| def resolve_is_enterprise_plan(plan_service: PlanService, info) -> bool: | ||
| return plan_service.is_enterprise_plan | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where are these
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOL I totally forgot that we swapped over that stuff to shared, let me open up a new PR for that part. It worked on my local because I modified shared directly |
||
|
|
||
|
|
||
| @plan_bindable.field("isFreePlan") | ||
| @sync_to_async | ||
| def resolve_is_free_plan(plan_service: PlanService, info) -> bool: | ||
| return plan_service.is_free_plan | ||
|
|
||
|
|
||
| @plan_bindable.field("isProPlan") | ||
| @sync_to_async | ||
| def resolve_is_pro_plan(plan_service: PlanService, info) -> bool: | ||
| return plan_service.is_pro_plan | ||
|
|
||
|
|
||
| @plan_bindable.field("isSentryPlan") | ||
| @sync_to_async | ||
| def resolve_is_sentry_plan(plan_service: PlanService, info) -> bool: | ||
| return plan_service.is_sentry_plan | ||
|
|
||
|
|
||
| @plan_bindable.field("isTeamPlan") | ||
| @sync_to_async | ||
| def resolve_is_team_plan(plan_service: PlanService, info) -> bool: | ||
| return plan_service.is_team_plan | ||
|
|
||
|
|
||
| @plan_bindable.field("isTrialPlan") | ||
| @sync_to_async | ||
| def resolve_is_trial_plan(plan_service: PlanService, info) -> bool: | ||
| return plan_service.is_trial_plan | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just organizing this in alphabetical