Spaces:
Sleeping
Sleeping
Download src/models/refresh_token.py from Tahasaif3/TaskFlow-Backend: direct link, hf CLI and curl.
- Browser
- Download file 868 Bytes
-
https://huggingface.co/spaces/Tahasaif3/TaskFlow-Backend/resolve/main/src/models/refresh_token.py
- Command line
-
hf download hf://spaces/Tahasaif3/TaskFlow-Backend/src/models/refresh_token.py
-
curl -L -o refresh_token.py https://huggingface.co/spaces/Tahasaif3/TaskFlow-Backend/resolve/main/src/models/refresh_token.py
868 Bytes
| from sqlmodel import SQLModel, Field, Relationship | |
| from typing import Optional | |
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import Column, DateTime, Boolean, String, ForeignKey | |
| class RefreshToken(SQLModel, table=True): | |
| id: Optional[uuid.UUID] = Field(default_factory=uuid.uuid4, primary_key=True) | |
| # Use a plain sa_column without `index=True` (SQLModel does not allow index=True when sa_column is provided) | |
| token_hash: str = Field(sa_column=Column(String(length=128))) | |
| user_id: Optional[uuid.UUID] = Field(foreign_key="user.id") | |
| revoked: bool = Field(default=False, sa_column=Column(Boolean, default=False)) | |
| created_at: datetime = Field(sa_column=Column(DateTime, default=datetime.utcnow)) | |
| expires_at: datetime = Field(sa_column=Column(DateTime)) | |
| # Relationship back to user is optional and not required for our use-case | |