Download models/task.py from MAWB/MCP_todo: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/spaces/MAWB/MCP_todo/resolve/main/models/task.py
- Command line
-
hf download hf://spaces/MAWB/MCP_todo/models/task.py
-
curl -L -o task.py https://huggingface.co/spaces/MAWB/MCP_todo/resolve/main/models/task.py
2.01 kB
| """ | |
| Task model representing user tasks. | |
| Per @specs/001-auth-api-bridge/data-model.md | |
| """ | |
| from sqlmodel import SQLModel, Field, Relationship | |
| from typing import TYPE_CHECKING, Optional | |
| from datetime import datetime | |
| from uuid import UUID, uuid4 | |
| if TYPE_CHECKING: | |
| from models.user import UserTable | |
| class TaskTable(SQLModel, table=True): | |
| """ | |
| Task owned by a user. | |
| Each task belongs to exactly one user. All queries MUST filter by user_id | |
| to ensure data isolation per constitutional principle. | |
| """ | |
| __tablename__ = "tasks" | |
| # Primary key | |
| id: UUID = Field( | |
| default_factory=uuid4, | |
| primary_key=True, | |
| index=True, | |
| description="Unique task identifier" | |
| ) | |
| # Foreign key to User | |
| user_id: UUID = Field( | |
| foreign_key="users.id", | |
| index=True, | |
| nullable=False, | |
| description="ID of the user who owns this task" | |
| ) | |
| # Task attributes | |
| title: str = Field( | |
| max_length=255, | |
| nullable=False, | |
| description="Short title of the task" | |
| ) | |
| description: Optional[str] = Field( | |
| default=None, | |
| max_length=5000, | |
| description="Detailed description of the task (optional)" | |
| ) | |
| # Completion status | |
| completed: bool = Field( | |
| default=False, | |
| index=True, | |
| description="Whether the task has been completed" | |
| ) | |
| # Priority level | |
| priority: str = Field( | |
| default="medium", | |
| nullable=False, | |
| description="Task priority level: low, medium, or high" | |
| ) | |
| # Timestamps | |
| created_at: datetime = Field( | |
| default_factory=datetime.utcnow, | |
| nullable=False, | |
| description="Timestamp when task was created" | |
| ) | |
| completed_at: Optional[datetime] = Field( | |
| default=None, | |
| nullable=True, | |
| index=True, | |
| description="Timestamp when task was marked as completed (null until completed)" | |
| ) | |
| # Relationships | |
| user: "UserTable" = Relationship(back_populates="tasks") | |