20 lines
580 B
Python
20 lines
580 B
Python
from sqlmodel import SQLModel, Field, Relationship
|
|
|
|
|
|
class Task(SQLModel, table=True):
|
|
__tablename__ = "tasks"
|
|
|
|
id: int | None = Field(default=None, primary_key=True)
|
|
hackathon_id: int = Field(foreign_key="hackathons.id")
|
|
title: str = Field(max_length=200)
|
|
description: str
|
|
requirements: str
|
|
evaluation_criteria: str
|
|
|
|
# Relationships
|
|
hackathon: "Hackathon" = Relationship(back_populates="tasks")
|
|
submissions: list["Submission"] = Relationship(
|
|
back_populates="task",
|
|
sa_relationship_kwargs={"cascade": "all, delete"},
|
|
)
|