-
Notifications
You must be signed in to change notification settings - Fork 30
✨ Introduce vip models pricing 1 of 2 parts #6897
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
Merged
matusdrobuliak66
merged 36 commits into
ITISFoundation:master
from
matusdrobuliak66:introduce-vip-models-pricing-2-part
Dec 5, 2024
Merged
Changes from 26 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
3bd4e3b
refactor RUT to use new transactional context
matusdrobuliak66 fd4a43f
fix
matusdrobuliak66 f5b73d7
Merge branch 'master' into introduce-vip-models-pricing
matusdrobuliak66 936027e
Merge branch 'master' into introduce-vip-models-pricing
matusdrobuliak66 88fdede
Merge branch 'master' into introduce-vip-models-pricing
matusdrobuliak66 5d0c6f7
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 20fa686
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 561c284
adding shortuuid
matusdrobuliak66 9f060de
add license db tables
matusdrobuliak66 6f9c844
upgrade postgres package - shortuuid
matusdrobuliak66 c296b0d
upgrade postgres package - shortuuid
matusdrobuliak66 af4642b
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 00fce00
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 bc83eb0
license goods DB layer
matusdrobuliak66 f2113ec
exeption handling
matusdrobuliak66 e570beb
open api specs
matusdrobuliak66 60b3132
adding db test
matusdrobuliak66 10988aa
remove db migration:
matusdrobuliak66 9b24815
add db migration:
matusdrobuliak66 28c86ff
open api specs
matusdrobuliak66 03c5f08
adding db test
matusdrobuliak66 e6c8d5c
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 d0107ad
fix naming
matusdrobuliak66 44fbf75
open api specs
matusdrobuliak66 deeb0f1
fix test
matusdrobuliak66 fb06946
propagate downstream dependencies everywhere
matusdrobuliak66 8c00993
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 b8c918b
PR reviews
matusdrobuliak66 c629b0a
PR reviews
matusdrobuliak66 50204c3
fix test
matusdrobuliak66 68ecfe5
fix test
matusdrobuliak66 9896a91
PR reviews
matusdrobuliak66 f919e4c
remove shortuuid
matusdrobuliak66 519c2ed
fix
matusdrobuliak66 894b636
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 038ea39
fix
matusdrobuliak66 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,60 @@ | ||
""" Helper script to generate OAS automatically | ||
""" | ||
|
||
# pylint: disable=redefined-outer-name | ||
# pylint: disable=unused-argument | ||
# pylint: disable=unused-variable | ||
# pylint: disable=too-many-arguments | ||
|
||
from typing import Annotated | ||
|
||
from _common import as_query | ||
from fastapi import APIRouter, Depends, status | ||
from models_library.api_schemas_webserver.license_goods import LicenseGoodGet | ||
from models_library.generics import Envelope | ||
from models_library.rest_error import EnvelopedError | ||
from simcore_service_webserver._meta import API_VTAG | ||
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP | ||
from simcore_service_webserver.licenses._models import ( | ||
LicenseGoodsBodyParams, | ||
LicenseGoodsListQueryParams, | ||
LicenseGoodsPathParams, | ||
) | ||
|
||
router = APIRouter( | ||
prefix=f"/{API_VTAG}", | ||
tags=[ | ||
"licenses", | ||
], | ||
responses={ | ||
i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values() | ||
}, | ||
) | ||
|
||
|
||
@router.get( | ||
"/license-goods", | ||
response_model=Envelope[list[LicenseGoodGet]], | ||
) | ||
async def list_license_goods( | ||
_query: Annotated[as_query(LicenseGoodsListQueryParams), Depends()], | ||
): | ||
... | ||
|
||
|
||
@router.get( | ||
"/license-goods/{license_good_id}", | ||
response_model=Envelope[LicenseGoodGet], | ||
) | ||
async def get_license_good( | ||
_path: Annotated[LicenseGoodsPathParams, Depends()], | ||
): | ||
... | ||
|
||
|
||
@router.post("/license-goods/{license_good_id}", status_code=status.HTTP_204_NO_CONTENT) | ||
async def purchase_license_good( | ||
_path: Annotated[LicenseGoodsPathParams, Depends()], | ||
_body: LicenseGoodsBodyParams, | ||
): | ||
... |
This file contains hidden or 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
22 changes: 22 additions & 0 deletions
22
packages/models-library/src/models_library/api_schemas_webserver/license_goods.py
This file contains hidden or 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,22 @@ | ||
from datetime import datetime | ||
from typing import NamedTuple | ||
|
||
from models_library.license_goods import LicenseGoodID, LicenseResourceType | ||
from models_library.resource_tracker import PricingPlanId | ||
from pydantic import PositiveInt | ||
|
||
from ._base import OutputSchema | ||
|
||
|
||
class LicenseGoodGet(OutputSchema): | ||
matusdrobuliak66 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
license_good_id: LicenseGoodID | ||
name: str | ||
license_resource_type: LicenseResourceType | ||
pricing_plan_id: PricingPlanId | ||
created_at: datetime | ||
modified_at: datetime | ||
|
||
|
||
class LicenseGoodGetPage(NamedTuple): | ||
items: list[LicenseGoodGet] | ||
total: PositiveInt |
43 changes: 43 additions & 0 deletions
43
packages/models-library/src/models_library/license_goods.py
This file contains hidden or 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,43 @@ | ||
from datetime import datetime | ||
from enum import auto | ||
from typing import TypeAlias | ||
|
||
from pydantic import BaseModel, ConfigDict, Field | ||
|
||
from .products import ProductName | ||
from .resource_tracker import PricingPlanId | ||
from .utils.enums import StrAutoEnum | ||
|
||
LicenseGoodID: TypeAlias = str | ||
|
||
|
||
class LicenseResourceType(StrAutoEnum): | ||
VIP_MODEL = auto() | ||
|
||
|
||
# | ||
# DB | ||
# | ||
|
||
|
||
class LicenseGoodDB(BaseModel): | ||
license_good_id: LicenseGoodID | ||
matusdrobuliak66 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: str | ||
license_resource_type: LicenseResourceType | ||
pricing_plan_id: PricingPlanId | ||
product_name: ProductName | ||
created: datetime = Field( | ||
..., | ||
description="Timestamp on creation", | ||
) | ||
modified: datetime = Field( | ||
..., | ||
description="Timestamp of last modification", | ||
) | ||
# ---- | ||
model_config = ConfigDict(from_attributes=True) | ||
|
||
|
||
class LicenseGoodUpdateDB(BaseModel): | ||
name: str | None = None | ||
pricing_plan_id: PricingPlanId | None = None |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.