init
This commit is contained in:
16
app/models/hackathon_participant.py
Normal file
16
app/models/hackathon_participant.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlmodel import SQLModel, Field, Relationship
|
||||
|
||||
|
||||
class HackathonParticipant(SQLModel, table=True):
|
||||
"""Регистрация участника на хакатон (many-to-many: User <-> Hackathon)."""
|
||||
|
||||
__tablename__ = "hackathon_participants"
|
||||
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
user_id: int = Field(foreign_key="users.id")
|
||||
hackathon_id: int = Field(foreign_key="hackathons.id")
|
||||
is_confirmed: bool = Field(default=False)
|
||||
|
||||
# Relationships
|
||||
user: "User" = Relationship(back_populates="registrations")
|
||||
hackathon: "Hackathon" = Relationship(back_populates="participants")
|
||||
Reference in New Issue
Block a user