Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
/codecov-apiPublic archive

feat: add plan tier service#150

Merged
adrian-codecov merged 10 commits intomainfrom412-plan-permissions
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
10 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletionsapi/internal/tests/views/test_plans_viewset.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@ def test_list_plans_returns_200_and_plans(self):
"Unlimited public repositories",
"Unlimited private repositories",
],
"tier_name": "basic",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -41,6 +42,7 @@ def test_list_plans_returns_200_and_plans(self):
"Unlimited public repositories",
"Unlimited private repositories",
],
"tier_name": "basic",
"monthly_uploads_limit": 250,
"trial_days": None,
},
Expand All@@ -55,6 +57,7 @@ def test_list_plans_returns_200_and_plans(self):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -69,6 +72,7 @@ def test_list_plans_returns_200_and_plans(self):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -91,6 +95,7 @@ def test_list_plans_sentry_user(self, is_sentry_user):
"Unlimited public repositories",
"Unlimited private repositories",
],
"tier_name": "basic",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -104,6 +109,7 @@ def test_list_plans_sentry_user(self, is_sentry_user):
"Unlimited public repositories",
"Unlimited private repositories",
],
"tier_name": "basic",
"monthly_uploads_limit": 250,
"trial_days": None,
},
Expand All@@ -118,6 +124,7 @@ def test_list_plans_sentry_user(self, is_sentry_user):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -132,6 +139,7 @@ def test_list_plans_sentry_user(self, is_sentry_user):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -147,6 +155,7 @@ def test_list_plans_sentry_user(self, is_sentry_user):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": 14,
},
Expand All@@ -162,6 +171,7 @@ def test_list_plans_sentry_user(self, is_sentry_user):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": 14,
},
Expand All@@ -184,6 +194,7 @@ def test_list_plans_anonymous_user(self):
"Unlimited public repositories",
"Unlimited private repositories",
],
"tier_name": "basic",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -197,6 +208,7 @@ def test_list_plans_anonymous_user(self):
"Unlimited public repositories",
"Unlimited private repositories",
],
"tier_name": "basic",
"monthly_uploads_limit": 250,
"trial_days": None,
},
Expand All@@ -211,6 +223,7 @@ def test_list_plans_anonymous_user(self):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand All@@ -225,6 +238,7 @@ def test_list_plans_anonymous_user(self):
"Unlimited private repositories",
"Priority Support",
],
"tier_name": "pro",
"monthly_uploads_limit": None,
"trial_days": None,
},
Expand Down
2 changes: 2 additions & 0 deletionsgraphql_api/tests/test_plan.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,6 +41,7 @@ def test_owner_plan_data_when_trialing(self):
trialStartDate
marketingName
planName
tierName
billingRate
baseUnitPrice
benefits
Expand All@@ -59,6 +60,7 @@ def test_owner_plan_data_when_trialing(self):
"trialStartDate": "2023-06-19T00:00:00",
"marketingName": "Developer",
"planName": "users-trial",
"tierName": "pro",
"billingRate": None,
"baseUnitPrice": 0,
"benefits": [
Expand Down
3 changes: 2 additions & 1 deletiongraphql_api/types/enums/enum_types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
ImpactedFileParameter,
)
from core.models import Commit
from plan.constants import TrialStatus
from plan.constants importTierName,TrialStatus
from services.yaml import YamlStates
from timeseries.models import Interval as MeasurementInterval
from timeseries.models import MeasurementName
Expand DownExpand Up@@ -43,6 +43,7 @@
EnumType("CommitState", Commit.CommitStates),
EnumType("MeasurementType", MeasurementName),
EnumType("RepositoryTokenType", RepositoryToken.TokenType),
EnumType("TierName", TierName),
EnumType("TrialStatus", TrialStatus),
EnumType("YamlStates", YamlStates),
]
6 changes: 6 additions & 0 deletionsgraphql_api/types/enums/tier_name.graphql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
enum TierName {
BASIC
LITE
PRO
ENTERPRISE
}
1 change: 1 addition & 0 deletionsgraphql_api/types/plan/plan.graphql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@ type Plan {
pretrialUsersCount: Int
marketingName: String!
planName: String!
tierName: String!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we use the GraphQL enum anywhere? Should this betierName: TierName! instead?

billingRate: String
baseUnitPrice: Int!
benefits: [String!]!
Expand Down
19 changes: 12 additions & 7 deletionsgraphql_api/types/plan/plan.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
PlanMarketingName,
PlanName,
PlanPrice,
TierName,
TrialStatus,
)
from plan.service import PlanService
Expand DownExpand Up@@ -38,25 +39,31 @@ def resolve_trial_status(plan_service: PlanService, info) -> TrialStatus:

@plan_bindable.field("marketingName")
@convert_kwargs_to_snake_case
def resolve_marketing_name(plan_service: PlanService, info) ->PlanMarketingName:
def resolve_marketing_name(plan_service: PlanService, info) ->str:
return plan_service.marketing_name


@plan_bindable.field("planName")
@convert_kwargs_to_snake_case
def resolve_plan_name(plan_service: PlanService, info) ->PlanName:
def resolve_plan_name(plan_service: PlanService, info) ->str:
return plan_service.plan_name


@plan_bindable.field("tierName")
@convert_kwargs_to_snake_case
def resolve_tier_name(plan_service: PlanService, info) -> str:
return plan_service.tier_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is where you could call.value on the enum. The return type would bestr.



@plan_bindable.field("billingRate")
@convert_kwargs_to_snake_case
def resolve_billing_rate(plan_service: PlanService, info) -> Optional[PlanBillingRate]:
def resolve_billing_rate(plan_service: PlanService, info) -> Optional[str]:
return plan_service.billing_rate


@plan_bindable.field("baseUnitPrice")
@convert_kwargs_to_snake_case
def resolve_base_unit_price(plan_service: PlanService, info) ->PlanPrice:
def resolve_base_unit_price(plan_service: PlanService, info) ->int:
return plan_service.base_unit_price


Expand All@@ -75,7 +82,5 @@ def resolve_pretrial_users_count(plan_service: PlanService, info) -> Optional[in

@plan_bindable.field("monthlyUploadLimit")
@convert_kwargs_to_snake_case
def resolve_monthly_uploads_limit(
plan_service: PlanService, info
) -> Optional[MonthlyUploadLimits]:
def resolve_monthly_uploads_limit(plan_service: PlanService, info) -> Optional[int]:
return plan_service.monthly_uploads_limit
12 changes: 5 additions & 7 deletionsgraphql_api/types/plan_representation/plan_representation.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,25 +23,25 @@

@plan_representation_bindable.field("marketingName")
@convert_kwargs_to_snake_case
def resolve_marketing_name(plan_data: PlanData, info) ->PlanMarketingName:
def resolve_marketing_name(plan_data: PlanData, info) ->str:
return plan_data.marketing_name


@plan_representation_bindable.field("planName")
@convert_kwargs_to_snake_case
def resolve_plan_name(plan_data: PlanData, info) ->PlanName:
def resolve_plan_name(plan_data: PlanData, info) ->str:
return plan_data.value


@plan_representation_bindable.field("billingRate")
@convert_kwargs_to_snake_case
def resolve_billing_rate(plan_data: PlanData, info) -> Optional[PlanBillingRate]:
def resolve_billing_rate(plan_data: PlanData, info) -> Optional[str]:
return plan_data.billing_rate


@plan_representation_bindable.field("baseUnitPrice")
@convert_kwargs_to_snake_case
def resolve_base_unit_price(plan_data: PlanData, info) ->PlanPrice:
def resolve_base_unit_price(plan_data: PlanData, info) ->int:
return plan_data.base_unit_price


Expand All@@ -63,7 +63,5 @@ def resolve_benefits(plan_data: PlanData, info) -> List[str]:

@plan_representation_bindable.field("monthlyUploadLimit")
@convert_kwargs_to_snake_case
def resolve_monthly_uploads_limit(
plan_data: PlanData, info
) -> Optional[MonthlyUploadLimits]:
def resolve_monthly_uploads_limit(plan_data: PlanData, info) -> Optional[int]:
return plan_data.monthly_uploads_limit
Loading

[8]ページ先頭

©2009-2026 Movatter.jp