Skip to content

Commit

Permalink
Merge branch 'introduce-vip-models-pricing-8-part' of github.com:matu…
Browse files Browse the repository at this point in the history
…sdrobuliak66/osparc-simcore into introduce-vip-models-pricing-8-part
  • Loading branch information
matusdrobuliak66 committed Dec 18, 2024
2 parents ae14a78 + e9dd8e5 commit 1ba77c0
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class LicensedItemGet(OutputSchema):
licensed_item_id: LicensedItemID
name: str
license_key: str | None
licensed_resource_type: LicensedResourceType
pricing_plan_id: PricingPlanId
created_at: datetime
Expand All @@ -21,6 +22,7 @@ class LicensedItemGet(OutputSchema):
{
"licensed_item_id": "0362b88b-91f8-4b41-867c-35544ad1f7a1",
"name": "best-model",
"license_key": "license-specific-key",
"licensed_resource_type": f"{LicensedResourceType.VIP_MODEL}",
"pricing_plan_id": "15",
"created_at": "2024-12-12 09:59:26.422140",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class LicensedResourceType(StrAutoEnum):
class LicensedItemDB(BaseModel):
licensed_item_id: LicensedItemID
name: str
license_key: str | None
licensed_resource_type: LicensedResourceType
pricing_plan_id: PricingPlanId
product_name: ProductName
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""add license key
Revision ID: d31c23845017
Revises: aa6da21a0055
Create Date: 2024-12-18 11:11:52.644534+00:00
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "d31c23845017"
down_revision = "aa6da21a0055"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"licensed_items", sa.Column("license_key", sa.String(), nullable=True)
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("licensed_items", "license_key")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class LicensedResourceType(str, enum.Enum):
nullable=False,
doc="Product name",
),
sa.Column(
"license_key",
sa.String,
nullable=True,
doc="Purpose: Acts as a mapping key to the internal license server. Usage: The Sim4Life base applications use this key to check out a seat from the internal license server.",
),
column_created_datetime(timezone=True),
column_modified_datetime(timezone=True),
)
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@ class LicensedItemGet(BaseModel):

assert set(LicensedItemGet.model_fields.keys()) == set(
_LicensedItemGet.model_fields.keys()
- {
"license_key"
} # NOTE: @bisgaard-itis please expose https://github.com/ITISFoundation/osparc-simcore/issues/6875
)
Original file line number Diff line number Diff line change
Expand Up @@ -10342,6 +10342,11 @@ components:
name:
type: string
title: Name
licenseKey:
anyOf:
- type: string
- type: 'null'
title: Licensekey
licensedResourceType:
$ref: '#/components/schemas/LicensedResourceType'
pricingPlanId:
Expand All @@ -10361,6 +10366,7 @@ components:
required:
- licensedItemId
- name
- licenseKey
- licensedResourceType
- pricingPlanId
- createdAt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async def get_licensed_item(
return LicensedItemGet(
licensed_item_id=licensed_item_db.licensed_item_id,
name=licensed_item_db.name,
license_key=licensed_item_db.license_key,
licensed_resource_type=licensed_item_db.licensed_resource_type,
pricing_plan_id=licensed_item_db.pricing_plan_id,
created_at=licensed_item_db.created,
Expand All @@ -68,6 +69,7 @@ async def list_licensed_items(
LicensedItemGet(
licensed_item_id=licensed_item_db.licensed_item_id,
name=licensed_item_db.name,
license_key=licensed_item_db.license_key,
licensed_resource_type=licensed_item_db.licensed_resource_type,
pricing_plan_id=licensed_item_db.pricing_plan_id,
created_at=licensed_item_db.created,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
_SELECTION_ARGS = (
licensed_items.c.licensed_item_id,
licensed_items.c.name,
licensed_items.c.license_key,
licensed_items.c.licensed_resource_type,
licensed_items.c.pricing_plan_id,
licensed_items.c.product_name,
Expand Down

0 comments on commit 1ba77c0

Please sign in to comment.