Skip to content

Commit

Permalink
fix(models): fix table references
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Sep 22, 2024
1 parent 158408b commit dfec3fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Role(str, Enum):
class User(SQLModel, table=True):
__tablename__ = "users"
id: int = Field(None, primary_key=True)
organization_id: int = Field(..., foreign_key="organization.id", nullable=False)
organization_id: int = Field(..., foreign_key="organizations.id", nullable=False)
role: UserRole = Field(UserRole.USER, nullable=False)
# Allow sign-up/in via login + password
login: str = Field(..., index=True, unique=True, min_length=2, max_length=50, nullable=False)
Expand All @@ -41,7 +41,7 @@ class User(SQLModel, table=True):
class Camera(SQLModel, table=True):
__tablename__ = "cameras"
id: int = Field(None, primary_key=True)
organization_id: int = Field(..., foreign_key="organization.id", nullable=False)
organization_id: int = Field(..., foreign_key="organizations.id", nullable=False)
name: str = Field(..., min_length=5, max_length=100, nullable=False, unique=True)
angle_of_view: float = Field(..., gt=0, le=360, nullable=False)
elevation: float = Field(..., gt=0, lt=10000, nullable=False)
Expand All @@ -56,7 +56,7 @@ class Camera(SQLModel, table=True):
class Detection(SQLModel, table=True):
__tablename__ = "detections"
id: int = Field(None, primary_key=True)
camera_id: int = Field(..., foreign_key="camera.id", nullable=False)
camera_id: int = Field(..., foreign_key="cameras.id", nullable=False)
azimuth: float = Field(..., gt=0, lt=360)
bucket_key: str
bboxes: str = Field(..., min_length=2, max_length=settings.MAX_BBOX_STR_LENGTH, nullable=False)
Expand Down

0 comments on commit dfec3fd

Please sign in to comment.