Spaces:
No application file
No application file
| """ | |
| User model for authentication. | |
| Represents a registered user account with hashed password. | |
| """ | |
| from sqlmodel import SQLModel, Field | |
| from datetime import datetime | |
| from uuid import UUID, uuid4 | |
| from typing import Optional | |
| class User(SQLModel, table=True): | |
| """User account model.""" | |
| __tablename__ = "users" | |
| id: UUID = Field(default_factory=uuid4, primary_key=True) | |
| username: str = Field(max_length=50, unique=True, index=True) | |
| hashed_password: str = Field(max_length=255) | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |
| updated_at: datetime = Field(default_factory=datetime.utcnow) | |
| class Config: | |
| json_schema_extra = { | |
| "example": { | |
| "id": "550e8400-e29b-41d4-a716-446655440000", | |
| "username": "johndoe", | |
| "created_at": "2026-02-05T12:00:00", | |
| "updated_at": "2026-02-05T12:00:00" | |
| } | |
| } | |