201 előtti mentés
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import enum
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List, Optional, TYPE_CHECKING
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import Column, Integer, String, Boolean, DateTime, ForeignKey, JSON, text, Numeric, BigInteger, Float
|
||||
from sqlalchemy.dialects.postgresql import ENUM as PG_ENUM, UUID as PG_UUID, JSONB
|
||||
@@ -13,6 +13,9 @@ from geoalchemy2 import Geometry
|
||||
# MB 2.0: A központi aszinkron adatbázis motorból húzzuk be a Base-t
|
||||
from app.database import Base
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .service_request import ServiceRequest
|
||||
|
||||
class OrgType(str, enum.Enum):
|
||||
individual = "individual"
|
||||
service = "service"
|
||||
@@ -222,6 +225,13 @@ class Branch(Base):
|
||||
|
||||
# Kapcsolatok (Primaryjoin tartva a rating rendszerhez)
|
||||
reviews: Mapped[List["Rating"]] = relationship(
|
||||
"Rating",
|
||||
"Rating",
|
||||
primaryjoin="and_(Branch.id==foreign(Rating.target_branch_id))"
|
||||
)
|
||||
|
||||
# Kapcsolat a ServiceRequest modellel
|
||||
service_requests: Mapped[List["ServiceRequest"]] = relationship(
|
||||
"ServiceRequest",
|
||||
back_populates="branch",
|
||||
cascade="all, delete-orphan"
|
||||
)
|
||||
Reference in New Issue
Block a user