Skip to content

Commit

Permalink
cleanup studio services
Browse files Browse the repository at this point in the history
  • Loading branch information
NodeJSmith committed Jan 14, 2025
1 parent 7c622c1 commit 6c29b81
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/otf_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]

Expand Down
57 changes: 20 additions & 37 deletions src/otf_api/models/studio_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6c29b81

Please sign in to comment.