diff --git a/src/otf_api/api.py b/src/otf_api/api.py index dbd7ca8..5c04c26 100644 --- a/src/otf_api/api.py +++ b/src/otf_api/api.py @@ -661,7 +661,7 @@ def get_studio_services(self, studio_uuid: str | None = None) -> list[models.Stu # manually add studio_uuid, the response data does not include it anywhere for d in data["data"]: - d["studio_uuid"] = studio_uuid + d["studio"] = self.get_studio_detail(studio_uuid) return [models.StudioService(**d) for d in data["data"]] diff --git a/src/otf_api/models/studio_services.py b/src/otf_api/models/studio_services.py index 519ab8b..eddec72 100644 --- a/src/otf_api/models/studio_services.py +++ b/src/otf_api/models/studio_services.py @@ -3,52 +3,35 @@ from pydantic import Field from otf_api.models.base import OtfItemBase - - -class Currency(OtfItemBase): - currency_alphabetic_code: str = Field(..., alias="currencyAlphabeticCode") - - -class DefaultCurrency(OtfItemBase): - currency_id: int = Field(..., alias="currencyId") - currency: Currency - - -class Country(OtfItemBase): - country_currency_code: str = Field(..., alias="countryCurrencyCode") - default_currency: DefaultCurrency = Field(..., alias="defaultCurrency") - - -class StudioLocation(OtfItemBase): - studio_location_id: int = Field(..., alias="studioLocationId") - country: Country - - -class Studio(OtfItemBase): - studio_id: int = Field(..., alias="studioId") - studio_location: StudioLocation = Field(..., alias="studioLocation") +from otf_api.models.studio_detail import StudioDetail class StudioService(OtfItemBase): - studio_uuid: str = Field(..., description="The OTF studio UUID") - service_id: int = Field(..., alias="serviceId") + studio: StudioDetail = Field(..., exclude=True, repr=False) + service_uuid: str = Field(..., alias="serviceUUId") - studio_id: int = Field(..., alias="studioId") name: str price: str qty: int - mbo_program_id: int = Field(..., alias="mboProgramId") - mbo_description_id: str = Field(..., alias="mboDescriptionId") - mbo_product_id: int = Field(..., alias="mboProductId") online_price: str = Field(..., alias="onlinePrice") tax_rate: str = Field(..., alias="taxRate") current: bool - is_web: bool = Field(..., alias="isWeb") - is_crm: bool = Field(..., alias="isCrm") - is_mobile: bool = Field(..., alias="isMobile") - created_by: str = Field(..., alias="createdBy") + is_deleted: bool = Field(..., alias="isDeleted") created_date: datetime = Field(..., alias="createdDate") - updated_by: str = Field(..., alias="updatedBy") updated_date: datetime = Field(..., alias="updatedDate") - is_deleted: bool = Field(..., alias="isDeleted") - studio: Studio + + # unused fields + + # ids + mbo_program_id: int | None = Field(None, alias="mboProgramId", exclude=True, repr=False) + mbo_description_id: str | None = Field(None, alias="mboDescriptionId", exclude=True, repr=False) + mbo_product_id: int | None = Field(None, alias="mboProductId", exclude=True, repr=False) + service_id: int | None = Field(None, alias="serviceId", exclude=True, repr=False) + studio_id: int | None = Field(None, alias="studioId", exclude=True, repr=False) + created_by: str | None = Field(None, alias="createdBy", exclude=True, repr=False) + updated_by: str | None = Field(None, alias="updatedBy", exclude=True, repr=False) + + # flags + is_web: bool | None = Field(None, alias="isWeb", exclude=True, repr=False) + is_crm: bool | None = Field(None, alias="isCrm", exclude=True, repr=False) + is_mobile: bool | None = Field(None, alias="isMobile", exclude=True, repr=False)