-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️✨ refactoring of pricing plans (🗃️) (#4812)
- Loading branch information
1 parent
a7f5940
commit a03ed85
Showing
61 changed files
with
3,203 additions
and
2,702 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ges/models-library/src/models_library/api_schemas_resource_usage_tracker/pricing_plans.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from datetime import datetime | ||
from decimal import Decimal | ||
from typing import Any, ClassVar | ||
|
||
from models_library.resource_tracker import ( | ||
PricingPlanClassification, | ||
PricingPlanId, | ||
PricingUnitCostId, | ||
PricingUnitId, | ||
) | ||
from pydantic import BaseModel | ||
|
||
|
||
class PricingUnitGet(BaseModel): | ||
pricing_unit_id: PricingUnitId | ||
unit_name: str | ||
current_cost_per_unit: Decimal | ||
current_cost_per_unit_id: PricingUnitCostId | ||
default: bool | ||
specific_info: dict | ||
|
||
class Config: | ||
schema_extra: ClassVar[dict[str, Any]] = { | ||
"examples": [ | ||
{ | ||
"pricing_unit_id": 1, | ||
"unit_name": "SMALL", | ||
"current_cost_per_unit": 5.7, | ||
"current_cost_per_unit_id": 1, | ||
"default": True, | ||
"specific_info": {}, | ||
} | ||
] | ||
} | ||
|
||
|
||
class ServicePricingPlanGet(BaseModel): | ||
pricing_plan_id: PricingPlanId | ||
display_name: str | ||
description: str | ||
classification: PricingPlanClassification | ||
created_at: datetime | ||
pricing_plan_key: str | ||
pricing_units: list[PricingUnitGet] | ||
|
||
class Config: | ||
schema_extra: ClassVar[dict[str, Any]] = { | ||
"examples": [ | ||
{ | ||
"pricing_plan_id": 1, | ||
"display_name": "Pricing Plan for Sleeper", | ||
"description": "Special Pricing Plan for Sleeper", | ||
"classification": "TIER", | ||
"created_at": "2023-01-11 13:11:47.293595", | ||
"pricing_plan_key": "pricing-plan-sleeper", | ||
"pricing_units": [ | ||
PricingUnitGet.Config.schema_extra["examples"][0] | ||
], | ||
} | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
...ages/models-library/src/models_library/api_schemas_resource_usage_tracker/service_runs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from datetime import datetime | ||
from decimal import Decimal | ||
|
||
from models_library.projects import ProjectID | ||
from models_library.projects_nodes_io import NodeID | ||
from models_library.resource_tracker import ( | ||
CreditTransactionStatus, | ||
ServiceRunId, | ||
ServiceRunStatus, | ||
) | ||
from models_library.services import ServiceKey, ServiceVersion | ||
from models_library.users import UserID | ||
from models_library.wallets import WalletID | ||
from pydantic import BaseModel | ||
|
||
|
||
class ServiceRunGet(BaseModel): | ||
service_run_id: ServiceRunId | ||
wallet_id: WalletID | None | ||
wallet_name: str | None | ||
user_id: UserID | ||
project_id: ProjectID | ||
project_name: str | ||
node_id: NodeID | ||
node_name: str | ||
service_key: ServiceKey | ||
service_version: ServiceVersion | ||
service_type: str | ||
service_resources: dict | ||
started_at: datetime | ||
stopped_at: datetime | None | ||
service_run_status: ServiceRunStatus | ||
# Cost in credits | ||
credit_cost: Decimal | None | ||
transaction_status: CreditTransactionStatus | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ class CreateServiceMetricsAdditionalParams(BaseModel): | |
wallet_id: WalletID | None | ||
wallet_name: str | None | ||
pricing_plan_id: int | None | ||
pricing_detail_id: int | None | ||
pricing_unit_id: int | None | ||
pricing_unit_cost_id: int | None | ||
product_name: str | ||
simcore_user_agent: str | ||
user_email: str | ||
|
@@ -28,7 +29,8 @@ class Config: | |
"wallet_id": 1, | ||
"wallet_name": "a private wallet for me", | ||
"pricing_plan_id": 1, | ||
"pricing_detail_id": 1, | ||
"pricing_unit_id": 1, | ||
"pricing_unit_detail_id": 1, | ||
"product_name": "osparc", | ||
"simcore_user_agent": "undefined", | ||
"user_email": "[email protected]", | ||
|
Oops, something went wrong.