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

✨ Introduce vip models pricing 1 of 2 parts #6897

Merged
Show file tree
Hide file tree
Changes from 22 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 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
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
60 changes: 60 additions & 0 deletions api/specs/web-server/_license_goods.py
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",
matusdrobuliak66 marked this conversation as resolved.
Show resolved Hide resolved
response_model=Envelope[list[LicenseGoodGet]],
)
async def list_workspaces(
_query: Annotated[as_query(LicenseGoodsListQueryParams), Depends()],
):
...


@router.get(
"/license-goods/{license_good_id}",
response_model=Envelope[LicenseGoodGet],
)
async def get_workspace(
_path: Annotated[LicenseGoodsPathParams, Depends()],
):
...


@router.post("/license-goods/{license_good_id}", status_code=status.HTTP_204_NO_CONTENT)
async def create_workspace_group(
_path: Annotated[LicenseGoodsPathParams, Depends()],
_body: LicenseGoodsBodyParams,
):
...
1 change: 1 addition & 0 deletions api/specs/web-server/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"_exporter",
"_folders",
"_long_running_tasks",
"_license_goods",
"_metamodeling",
"_nih_sparc",
"_nih_sparc_redirections",
Expand Down
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 packages/models-library/src/models_library/license_goods.py
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
1 change: 1 addition & 0 deletions packages/postgres-database/requirements/_base.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ pydantic
sqlalchemy[postgresql_psycopg2binary,postgresql_asyncpg] # SEE extras in https://github.com/sqlalchemy/sqlalchemy/blob/main/setup.cfg#L43
opentelemetry-instrumentation-asyncpg
yarl
shortuuid
47 changes: 28 additions & 19 deletions packages/postgres-database/requirements/_base.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile _base.in
#
alembic==1.13.3
# via -r requirements/_base.in
# via -r _base.in
annotated-types==0.7.0
# via pydantic
async-timeout==4.0.3
Expand All @@ -18,8 +24,8 @@ importlib-metadata==8.4.0
# via opentelemetry-api
mako==1.3.5
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -c ../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c ../../../requirements/constraints.txt
# alembic
markupsafe==2.1.5
# via mako
Expand All @@ -33,34 +39,34 @@ opentelemetry-api==1.27.0
opentelemetry-instrumentation==0.48b0
# via opentelemetry-instrumentation-asyncpg
opentelemetry-instrumentation-asyncpg==0.48b0
# via -r requirements/_base.in
# via -r _base.in
opentelemetry-semantic-conventions==0.48b0
# via opentelemetry-instrumentation-asyncpg
orjson==3.10.11
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/common-library/requirements/_base.in
# -c ../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c ../../../requirements/constraints.txt
# -r ../../../packages/common-library/requirements/_base.in
psycopg2-binary==2.9.9
# via sqlalchemy
pydantic==2.9.2
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/common-library/requirements/_base.in
# -r requirements/_base.in
# -c ../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c ../../../requirements/constraints.txt
# -r ../../../packages/common-library/requirements/_base.in
# -r _base.in
# pydantic-extra-types
pydantic-core==2.23.4
# via pydantic
pydantic-extra-types==2.10.0
# via -r requirements/../../../packages/common-library/requirements/_base.in
setuptools==75.2.0
# via opentelemetry-instrumentation
sqlalchemy==1.4.54
# via -r ../../../packages/common-library/requirements/_base.in
shortuuid==1.0.13
# via -r _base.in
sqlalchemy[postgresql-asyncpg,postgresql-psycopg2binary,postgresql_asyncpg,postgresql_psycopg2binary]==1.4.54
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/_base.in
# -c ../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c ../../../requirements/constraints.txt
# -r _base.in
# alembic
typing-extensions==4.12.2
# via
Expand All @@ -73,6 +79,9 @@ wrapt==1.16.0
# deprecated
# opentelemetry-instrumentation
yarl==1.12.1
# via -r requirements/_base.in
# via -r _base.in
zipp==3.20.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
2 changes: 1 addition & 1 deletion packages/postgres-database/requirements/_migration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ certifi==2024.8.30
# via
# -c requirements/../../../requirements/constraints.txt
# requests
charset-normalizer==3.3.2
charset-normalizer==3.4.0
# via requests
click==8.1.7
# via -r requirements/_migration.in
Expand Down
17 changes: 9 additions & 8 deletions packages/postgres-database/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ async-timeout==4.0.3
# aiopg
attrs==24.2.0
# via pytest-docker
coverage==7.6.1
coverage==7.6.8
# via
# -r requirements/_test.in
# pytest-cov
faker==29.0.0
faker==33.1.0
# via -r requirements/_test.in
greenlet==3.1.1
# via
Expand All @@ -19,11 +19,11 @@ greenlet==3.1.1
# sqlalchemy
iniconfig==2.0.0
# via pytest
mypy==1.12.0
mypy==1.13.0
# via sqlalchemy
mypy-extensions==1.0.0
# via mypy
packaging==24.1
packaging==24.2
# via pytest
pluggy==1.5.0
# via pytest
Expand All @@ -32,7 +32,7 @@ psycopg2-binary==2.9.9
# -c requirements/_base.txt
# aiopg
# sqlalchemy
pytest==8.3.3
pytest==8.3.4
# via
# -r requirements/_test.in
# pytest-asyncio
Expand All @@ -43,7 +43,7 @@ pytest-asyncio==0.23.8
# via
# -c requirements/../../../requirements/constraints.txt
# -r requirements/_test.in
pytest-cov==5.0.0
pytest-cov==6.0.0
# via -r requirements/_test.in
pytest-docker==3.1.1
# via -r requirements/_test.in
Expand All @@ -70,14 +70,15 @@ sqlalchemy2-stubs==0.0.2a38
# via sqlalchemy
types-docker==7.1.0.20240827
# via -r requirements/_test.in
types-psycopg2==2.9.21.20240819
types-psycopg2==2.9.21.20241019
# via -r requirements/_test.in
types-requests==2.32.0.20240914
types-requests==2.32.0.20241016
# via types-docker
typing-extensions==4.12.2
# via
# -c requirements/_base.txt
# -c requirements/_migration.txt
# faker
# mypy
# sqlalchemy2-stubs
urllib3==2.2.3
Expand Down
36 changes: 17 additions & 19 deletions packages/postgres-database/requirements/_tools.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
astroid==3.3.4
astroid==3.3.5
# via pylint
black==24.8.0
black==24.10.0
# via -r requirements/../../../requirements/devenv.txt
build==1.2.2
build==1.2.2.post1
# via pip-tools
bump2version==1.0.1
# via -r requirements/../../../requirements/devenv.txt
Expand All @@ -12,21 +12,21 @@ click==8.1.7
# via
# black
# pip-tools
dill==0.3.8
dill==0.3.9
# via pylint
distlib==0.3.8
distlib==0.3.9
# via virtualenv
filelock==3.16.1
# via virtualenv
identify==2.6.1
identify==2.6.3
# via pre-commit
isort==5.13.2
# via
# -r requirements/../../../requirements/devenv.txt
# pylint
mccabe==0.7.0
# via pylint
mypy==1.12.0
mypy==1.13.0
# via
# -c requirements/_test.txt
# -r requirements/../../../requirements/devenv.txt
Expand All @@ -37,14 +37,14 @@ mypy-extensions==1.0.0
# mypy
nodeenv==1.9.1
# via pre-commit
packaging==24.1
packaging==24.2
# via
# -c requirements/_test.txt
# black
# build
pathspec==0.12.1
# via black
pip==24.2
pip==24.3.1
# via pip-tools
pip-tools==7.4.1
# via -r requirements/../../../requirements/devenv.txt
Expand All @@ -53,11 +53,11 @@ platformdirs==4.3.6
# black
# pylint
# virtualenv
pre-commit==3.8.0
pre-commit==4.0.1
# via -r requirements/../../../requirements/devenv.txt
pylint==3.3.0
pylint==3.3.2
# via -r requirements/../../../requirements/devenv.txt
pyproject-hooks==1.1.0
pyproject-hooks==1.2.0
# via
# build
# pip-tools
Expand All @@ -66,20 +66,18 @@ pyyaml==6.0.2
# -c requirements/../../../requirements/constraints.txt
# -c requirements/_test.txt
# pre-commit
ruff==0.6.7
ruff==0.8.1
# via -r requirements/../../../requirements/devenv.txt
setuptools==75.2.0
# via
# -c requirements/_base.txt
# pip-tools
setuptools==75.6.0
# via pip-tools
tomlkit==0.13.2
# via pylint
typing-extensions==4.12.2
# via
# -c requirements/_base.txt
# -c requirements/_test.txt
# mypy
virtualenv==20.26.5
virtualenv==20.28.0
# via pre-commit
wheel==0.44.0
wheel==0.45.1
# via pip-tools
Loading
Loading