-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared: Migrate to Plan / Tier Tables #479
Changes from 14 commits
fbbb396
52fdc2d
33d98f6
ba68a8b
3b1deb6
7eb00e4
4fd5090
7473f20
ccb28ab
208eb10
a9a5eeb
3dcd8ef
6b1fabc
906e7bc
2cd7436
8277f6d
5c8398a
d2c0af3
7804571
0e2207e
6e1418a
a4bd8f7
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 |
---|---|---|
|
@@ -73,6 +73,8 @@ class TierName(enum.Enum): | |
TEAM = "team" | ||
PRO = "pro" | ||
ENTERPRISE = "enterprise" | ||
SENTRY = "sentry" | ||
TRIAL = "trial" | ||
|
||
|
||
@dataclass(repr=False) | ||
|
@@ -99,7 +101,6 @@ def convert_to_DTO(self) -> dict: | |
"benefits": self.benefits, | ||
"tier_name": self.tier_name, | ||
"monthly_uploads_limit": self.monthly_uploads_limit, | ||
"trial_days": self.trial_days, | ||
"is_free_plan": self.tier_name == TierName.BASIC.value, | ||
"is_pro_plan": self.tier_name == TierName.PRO.value, | ||
"is_team_plan": self.tier_name == TierName.TEAM.value, | ||
|
@@ -109,6 +110,24 @@ def convert_to_DTO(self) -> dict: | |
} | ||
|
||
|
||
def convert_to_DTO(plan) -> dict: | ||
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. Thoughts on typing this? 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. I was getting a circular dependency trying to import the Plan class and type it that way, is there another way we can do it? 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. So why is this a circular dependency? I suppose cause you'd import Plan, and plan imports from constants. So, this being the only thing that imports from Plan, could this belong in plan instead? You'd have to make an instance of Plan to use this wherever you do though 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. yeah exactly, I kinda wanted to avoid having to bind this function to a class when it's really just a "transformer" from our plan object to the plan object that the planService and subsequently GQL expects 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. I see. I'll leave the implementation up to you, I think though that not typing a function because of circular imports feels a bit odd, but you're getting of the fn soon right? If so I wouldn't say it's a big deal |
||
return { | ||
"marketing_name": plan.marketing_name, | ||
"value": plan.name, | ||
"billing_rate": plan.billing_rate, | ||
"base_unit_price": plan.base_unit_price, | ||
"benefits": plan.benefits, | ||
"tier_name": plan.tier.tier_name, | ||
"monthly_uploads_limit": plan.monthly_uploads_limit, | ||
"is_free_plan": not plan.paid_plan, | ||
"is_pro_plan": plan.tier.tier_name == TierName.PRO.value, | ||
"is_team_plan": plan.tier.tier_name == TierName.TEAM.value, | ||
"is_enterprise_plan": plan.tier.tier_name == TierName.ENTERPRISE.value, | ||
"is_trial_plan": plan.tier.tier_name == TierName.TRIAL.value, | ||
"is_sentry_plan": plan.tier.tier_name == TierName.SENTRY.value, | ||
} | ||
|
||
|
||
NON_PR_AUTHOR_PAID_USER_PLAN_REPRESENTATIONS = { | ||
PlanName.CODECOV_PRO_MONTHLY_LEGACY.value: PlanData( | ||
marketing_name=PlanMarketingName.CODECOV_PRO.value, | ||
|
@@ -189,7 +208,7 @@ def convert_to_DTO(self) -> dict: | |
"Unlimited private repositories", | ||
"Priority Support", | ||
], | ||
tier_name=TierName.PRO.value, | ||
tier_name=TierName.SENTRY.value, | ||
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. note: These consts are all disappearing soon and aren't / shouldn't be a SOT for anything anymore |
||
trial_days=TrialDaysAmount.CODECOV_SENTRY.value, | ||
monthly_uploads_limit=None, | ||
), | ||
|
@@ -205,7 +224,7 @@ def convert_to_DTO(self) -> dict: | |
"Unlimited private repositories", | ||
"Priority Support", | ||
], | ||
tier_name=TierName.PRO.value, | ||
tier_name=TierName.SENTRY.value, | ||
trial_days=TrialDaysAmount.CODECOV_SENTRY.value, | ||
monthly_uploads_limit=None, | ||
), | ||
|
@@ -342,7 +361,7 @@ def convert_to_DTO(self) -> dict: | |
"Unlimited private repositories", | ||
"Priority Support", | ||
], | ||
tier_name=TierName.PRO.value, | ||
tier_name=TierName.TRIAL.value, | ||
trial_days=None, | ||
monthly_uploads_limit=None, | ||
), | ||
|
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.
Could we make this a class method, like serialized plan or something