| 22 | |
| 23 | |
| 24 | class Card(SQLModel, table=True): |
| 25 | id: uuid.UUID | None = Field(default_factory=uuid.uuid4, primary_key=True) |
| 26 | front: str = Field(max_length=3000) |
| 27 | back: str = Field(max_length=3000) |
| 28 | collection_id: uuid.UUID = Field(foreign_key="collection.id", index=True) |
| 29 | collection: Collection = Relationship(back_populates="cards") |
| 30 | created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)) |
| 31 | updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)) |
| 32 | practice_cards: list["PracticeCard"] = Relationship( |
| 33 | back_populates="card", sa_relationship_kwargs={"cascade": "all, delete"} |
| 34 | ) |
| 35 | |
| 36 | |
| 37 | class PracticeSession(SQLModel, table=True): |
no outgoing calls