37 lines
1014 B
Python
37 lines
1014 B
Python
from typing import Annotated
|
|
|
|
from litestar.contrib.sqlalchemy.base import BigIntBase
|
|
from litestar.contrib.sqlalchemy.dto import SQLAlchemyDTO
|
|
from litestar.dto import DTOConfig
|
|
from sqlalchemy.orm import Mapped
|
|
|
|
from app.lib import service
|
|
from app.lib.company_owned_repository import CompanyOwnedRepository
|
|
|
|
|
|
class Machine_00374(BigIntBase):
|
|
__tablename__ = "machines" # type: ignore[assignment]
|
|
__table_args__ = {'extend_existing': True}
|
|
|
|
caption: Mapped[str]
|
|
enabled: Mapped[bool]
|
|
alive: Mapped[bool]
|
|
deleted: Mapped[bool]
|
|
external_id: Mapped[str]
|
|
owner_id: Mapped[int]
|
|
|
|
|
|
class Repository(CompanyOwnedRepository[Machine_00374]):
|
|
model_type = Machine_00374
|
|
alive_flag = "alive"
|
|
company_id_field = "owner_id"
|
|
|
|
|
|
class Service(service.Service[Machine_00374]):
|
|
repository_type = Repository
|
|
|
|
|
|
write_config = DTOConfig(exclude={"id"})
|
|
Machine_00374_WriteDTO = SQLAlchemyDTO[Annotated[Machine_00374, write_config]]
|
|
Machine_00374_ReadDTO = SQLAlchemyDTO[Machine_00374]
|