init
This commit is contained in:
20
app/models/team.py
Normal file
20
app/models/team.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from sqlmodel import SQLModel, Field, Relationship
|
||||
|
||||
|
||||
class Team(SQLModel, table=True):
|
||||
__tablename__ = "teams"
|
||||
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
name: str = Field(max_length=100)
|
||||
hackathon_id: int = Field(foreign_key="hackathons.id")
|
||||
|
||||
# Relationships
|
||||
hackathon: "Hackathon" = Relationship(back_populates="teams")
|
||||
members: list["TeamMember"] = Relationship(
|
||||
back_populates="team",
|
||||
sa_relationship_kwargs={"cascade": "all, delete"},
|
||||
)
|
||||
submissions: list["Submission"] = Relationship(
|
||||
back_populates="team",
|
||||
sa_relationship_kwargs={"cascade": "all, delete"},
|
||||
)
|
||||
Reference in New Issue
Block a user