Spaces:
Sleeping
Sleeping
Download src/models/user.py from Tahasaif3/Task-Flow-App: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/Tahasaif3/Task-Flow-App/resolve/ea80cf69c2fc1111d7dbf71be4febd419fc52211/src/models/user.py
- Command line
-
hf download hf://spaces/Tahasaif3/Task-Flow-App@ea80cf69c2fc1111d7dbf71be4febd419fc52211/src/models/user.py
-
curl -L -o user.py https://huggingface.co/spaces/Tahasaif3/Task-Flow-App/resolve/ea80cf69c2fc1111d7dbf71be4febd419fc52211/src/models/user.py
1.03 kB
| from sqlmodel import SQLModel, Field, Relationship | |
| from typing import Optional, List | |
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import Column, DateTime | |
| class UserBase(SQLModel): | |
| email: str = Field(unique=True, index=True, max_length=255) | |
| class User(UserBase, table=True): | |
| id: Optional[uuid.UUID] = Field(default_factory=uuid.uuid4, primary_key=True) | |
| email: str = Field(unique=True, index=True, max_length=255) | |
| password_hash: str = Field(max_length=255) | |
| created_at: datetime = Field(sa_column=Column(DateTime, default=datetime.utcnow)) | |
| updated_at: datetime = Field(sa_column=Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)) | |
| # Relationship to tasks | |
| tasks: List["Task"] = Relationship(back_populates="owner") | |
| # Relationship to projects | |
| projects: List["Project"] = Relationship(back_populates="owner") | |
| class UserCreate(UserBase): | |
| password: str | |
| class UserRead(UserBase): | |
| id: uuid.UUID | |
| created_at: datetime | |
| updated_at: datetime |