Spaces:
No application file
No application file
Download backend/models/assignment.py from cihanemres/okuma-app: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/cihanemres/okuma-app/resolve/main/backend/models/assignment.py
- Command line
-
hf download hf://spaces/cihanemres/okuma-app/backend/models/assignment.py
-
curl -L -o assignment.py https://huggingface.co/spaces/cihanemres/okuma-app/resolve/main/backend/models/assignment.py
1.15 kB
| from sqlalchemy import Column, Integer, String, DateTime, Enum as SQLEnum, ForeignKey | |
| from sqlalchemy.orm import relationship | |
| from sqlalchemy.sql import func | |
| import enum | |
| from database import Base | |
| class AssignmentStatus(str, enum.Enum): | |
| PENDING = "bekliyor" | |
| COMPLETED = "tamamlandi" | |
| OVERDUE = "gecikti" | |
| class Assignment(Base): | |
| __tablename__ = "assignments" | |
| id = Column(Integer, primary_key=True, index=True) | |
| teacher_id = Column(Integer, ForeignKey("users.id"), nullable=False) | |
| student_id = Column(Integer, ForeignKey("users.id"), nullable=False) | |
| story_id = Column(Integer, ForeignKey("stories.id"), nullable=False) | |
| status = Column(SQLEnum(AssignmentStatus), default=AssignmentStatus.PENDING) | |
| assigned_at = Column(DateTime(timezone=True), server_default=func.now()) | |
| due_date = Column(DateTime(timezone=True), nullable=True) | |
| completed_at = Column(DateTime(timezone=True), nullable=True) | |
| # Relationships | |
| teacher = relationship("User", foreign_keys=[teacher_id]) | |
| student = relationship("User", foreign_keys=[student_id], back_populates="assignments") | |
| story = relationship("Story") | |