Skip to content

Commit

Permalink
allow to populate cover models by name
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Dec 5, 2024
1 parent 947ffd8 commit f7c82c2
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@
)
from models_library.users import GroupID
from models_library.wallets import WalletID, WalletStatus
from pydantic import BaseModel, Field, NonNegativeFloat, NonNegativeInt, PlainSerializer
from pydantic import (
BaseModel,
ConfigDict,
Field,
NonNegativeFloat,
NonNegativeInt,
PlainSerializer,
)


class GetCreditPriceLegacy(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
product_name: str = Field(alias="productName")
usd_per_credit: (
Annotated[
Expand Down Expand Up @@ -56,6 +66,9 @@ class GetCreditPriceLegacy(BaseModel):


class PricingUnitGetLegacy(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
pricing_unit_id: PricingUnitId = Field(alias="pricingUnitId")
unit_name: str = Field(alias="unitName")
unit_extra_info: UnitExtraInfo = Field(alias="unitExtraInfo")
Expand All @@ -71,6 +84,9 @@ class PricingUnitGetLegacy(BaseModel):


class WalletGetWithAvailableCreditsLegacy(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
wallet_id: WalletID = Field(alias="walletId")
name: IDStr
description: str | None = None
Expand All @@ -90,6 +106,9 @@ class WalletGetWithAvailableCreditsLegacy(BaseModel):


class ServicePricingPlanGetLegacy(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
pricing_plan_id: PricingPlanId = Field(alias="pricingPlanId")
display_name: str = Field(alias="displayName")
description: str
Expand Down

0 comments on commit f7c82c2

Please sign in to comment.