Spaces:
Running
Running
| import uuid | |
| from decimal import Decimal | |
| from typing import Optional, TYPE_CHECKING | |
| from sqlmodel import Field, SQLModel, Relationship | |
| if TYPE_CHECKING: | |
| from .team import Team | |
| from .procedure_type import ProcedureType | |
| class TeamProcedureValue(SQLModel, table=True): | |
| """ | |
| Intermediate table between Team and ProcedureType. | |
| Holds the custom contract pricing and goals for a specific team. | |
| """ | |
| __tablename__ = "team_procedure_values" | |
| team_id: uuid.UUID = Field(foreign_key="teams.id", primary_key=True) | |
| procedure_type_id: int = Field(foreign_key="procedure_types.id", primary_key=True) | |
| custom_value: Decimal = Field(default=0, max_digits=10, decimal_places=2) | |
| custom_goal: Optional[int] = Field(default=None) | |
| # Relationships | |
| team: "Team" = Relationship(back_populates="procedure_values") | |
| procedure_type: "ProcedureType" = Relationship(back_populates="team_values") | |