Skip to content
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

♻️ RUT: add pricing plan LICENSE type 🗃️ #6922

Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3bd4e3b
refactor RUT to use new transactional context
matusdrobuliak66 Dec 1, 2024
fd4a43f
fix
matusdrobuliak66 Dec 1, 2024
f5b73d7
Merge branch 'master' into introduce-vip-models-pricing
matusdrobuliak66 Dec 2, 2024
936027e
Merge branch 'master' into introduce-vip-models-pricing
matusdrobuliak66 Dec 2, 2024
88fdede
Merge branch 'master' into introduce-vip-models-pricing
matusdrobuliak66 Dec 2, 2024
5d0c6f7
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 3, 2024
20fa686
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 3, 2024
561c284
adding shortuuid
matusdrobuliak66 Dec 3, 2024
9f060de
add license db tables
matusdrobuliak66 Dec 3, 2024
6f9c844
upgrade postgres package - shortuuid
matusdrobuliak66 Dec 3, 2024
c296b0d
upgrade postgres package - shortuuid
matusdrobuliak66 Dec 3, 2024
af4642b
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 3, 2024
00fce00
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 4, 2024
bc83eb0
license goods DB layer
matusdrobuliak66 Dec 4, 2024
f2113ec
exeption handling
matusdrobuliak66 Dec 4, 2024
e570beb
open api specs
matusdrobuliak66 Dec 4, 2024
60b3132
adding db test
matusdrobuliak66 Dec 4, 2024
10988aa
remove db migration:
matusdrobuliak66 Dec 4, 2024
9b24815
add db migration:
matusdrobuliak66 Dec 4, 2024
28c86ff
open api specs
matusdrobuliak66 Dec 4, 2024
03c5f08
adding db test
matusdrobuliak66 Dec 4, 2024
e6c8d5c
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 4, 2024
d0107ad
fix naming
matusdrobuliak66 Dec 4, 2024
44fbf75
open api specs
matusdrobuliak66 Dec 4, 2024
deeb0f1
fix test
matusdrobuliak66 Dec 4, 2024
fb06946
propagate downstream dependencies everywhere
matusdrobuliak66 Dec 4, 2024
8c00993
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 5, 2024
b8c918b
PR reviews
matusdrobuliak66 Dec 5, 2024
c629b0a
PR reviews
matusdrobuliak66 Dec 5, 2024
50204c3
fix test
matusdrobuliak66 Dec 5, 2024
68ecfe5
fix test
matusdrobuliak66 Dec 5, 2024
9896a91
PR reviews
matusdrobuliak66 Dec 5, 2024
f919e4c
remove shortuuid
matusdrobuliak66 Dec 5, 2024
519c2ed
fix
matusdrobuliak66 Dec 5, 2024
894b636
Merge branch 'master' into introduce-vip-models-pricing-2-part
matusdrobuliak66 Dec 5, 2024
038ea39
fix
matusdrobuliak66 Dec 5, 2024
78021f1
merge master
matusdrobuliak66 Dec 9, 2024
54ee485
adding LICENSE enum to RUT
matusdrobuliak66 Dec 9, 2024
1bc8052
open api specs
matusdrobuliak66 Dec 9, 2024
cba460c
Merge branch 'master' into introduce-vip-models-pricing-3-part
matusdrobuliak66 Dec 9, 2024
28af882
migration
matusdrobuliak66 Dec 9, 2024
61abd1c
migration
matusdrobuliak66 Dec 9, 2024
7dc1a38
Merge branch 'master' into introduce-vip-models-pricing-3-part
matusdrobuliak66 Dec 10, 2024
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
Prev Previous commit
Next Next commit
open api specs
matusdrobuliak66 committed Dec 4, 2024
commit 28c86ff0c1b038f796619ebae51cfc3b09f4028a
4 changes: 2 additions & 2 deletions packages/models-library/src/models_library/license_goods.py
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@
from enum import auto
from typing import TypeAlias

from pydantic import BaseModel, ConfigDict, Field, PositiveInt
from pydantic import BaseModel, ConfigDict, Field

from .products import ProductName
from .resource_tracker import PricingPlanId
from .utils.enums import StrAutoEnum

LicenseGoodID: TypeAlias = PositiveInt
LicenseGoodID: TypeAlias = str


class LicenseResourceType(StrAutoEnum):
Original file line number Diff line number Diff line change
@@ -2969,10 +2969,8 @@ paths:
in: path
required: true
schema:
type: integer
exclusiveMinimum: true
type: string
title: License Good Id
minimum: 0
responses:
'200':
description: Successful Response
@@ -2996,10 +2994,8 @@ paths:
in: path
required: true
schema:
type: integer
exclusiveMinimum: true
type: string
title: License Good Id
minimum: 0
requestBody:
required: true
content:
@@ -4544,7 +4540,7 @@ paths:
'403':
description: ProjectInvalidRightsError
'404':
description: UserDefaultWalletNotFoundError, ProjectNotFoundError
description: ProjectNotFoundError, UserDefaultWalletNotFoundError
'409':
description: ProjectTooManyProjectOpenedError
'422':
@@ -10010,10 +10006,8 @@ components:
LicenseGoodGet:
properties:
licenseGoodId:
type: integer
exclusiveMinimum: true
type: string
title: Licensegoodid
minimum: 0
name:
type: string
title: Name
Original file line number Diff line number Diff line change
@@ -17,20 +17,55 @@
from models_library.rest_ordering import OrderBy
from pytest_simcore.helpers.webserver_login import UserInfoDict
from servicelib.aiohttp import status
from simcore_postgres_database.models.resource_tracker_pricing_plans import (
resource_tracker_pricing_plans,
)
from simcore_postgres_database.utils_repos import transaction_context
from simcore_service_webserver.db.models import UserRole
from simcore_service_webserver.db.plugin import get_asyncpg_engine
from simcore_service_webserver.licenses import _license_goods_db
from simcore_service_webserver.licenses.errors import LicenseGoodNotFoundError
from simcore_service_webserver.projects.models import ProjectDict


@pytest.fixture
async def pricing_plan_id(
client: TestClient,
osparc_product_name: str,
) -> AsyncIterator[int]:
assert client.app

async with transaction_context(get_asyncpg_engine(client.app)) as conn:
result = await conn.execute(
resource_tracker_pricing_plans.insert()
.values(
product_name=osparc_product_name,
display_name="ISolve Thermal",
description="",
classification="TIER",
is_active=True,
pricing_plan_key="isolve-thermal",
)
.returning(resource_tracker_pricing_plans.c.pricing_plan_id)
)
row = result.first()

assert row

yield int(row[0])

async with transaction_context(get_asyncpg_engine(client.app)) as conn:
result = await conn.execute(resource_tracker_pricing_plans.delete())


@pytest.mark.parametrize("user_role,expected", [(UserRole.USER, status.HTTP_200_OK)])
async def test_license_goods_db_crud(
client: TestClient,
logged_user: UserInfoDict,
user_project: ProjectDict,
osparc_product_name: str,
expected: HTTPStatus,
workspaces_clean_db: AsyncIterator[None],
pricing_plan_id: int,
):
assert client.app

@@ -48,7 +83,7 @@ async def test_license_goods_db_crud(
product_name=osparc_product_name,
name="Model A",
license_resource_type=LicenseResourceType.VIP_MODEL,
pricing_plan_id=1,
pricing_plan_id=pricing_plan_id,
)
_license_good_id = license_good_db.license_good_id