17 lines
629 B
Python
17 lines
629 B
Python
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")
|