Spaces:
Sleeping
Sleeping
Download src/models/user.py from ibad363/todo-backend: direct link, hf CLI and curl.
- Browser
- Download file 773 Bytes
-
https://huggingface.co/spaces/ibad363/todo-backend/resolve/main/src/models/user.py
- Command line
-
hf download hf://spaces/ibad363/todo-backend/src/models/user.py
-
curl -L -o user.py https://huggingface.co/spaces/ibad363/todo-backend/resolve/main/src/models/user.py
773 Bytes
| from datetime import datetime | |
| from typing import Optional, List | |
| from sqlmodel import SQLModel, Field, Relationship | |
| from pydantic import EmailStr, ConfigDict | |
| class UserBase(SQLModel): | |
| email: EmailStr = Field(unique=True, index=True) | |
| class User(UserBase, table=True): | |
| id: Optional[int] = Field(default=None, primary_key=True) | |
| password_hash: str | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |
| tasks: List["Task"] = Relationship(back_populates="user") | |
| class UserRegister(UserBase): | |
| password: str = Field(min_length=8) | |
| class UserLogin(UserBase): | |
| password: str | |
| class UserRead(UserBase): | |
| id: int | |
| created_at: datetime | |
| class TokenResponse(SQLModel): | |
| access_token: str | |
| token_type: str = "bearer" | |
| expires_in: int | |