
- Fix unused imports in API endpoints - Add proper __all__ exports in model and schema modules - Add proper TYPE_CHECKING imports in models to prevent circular imports - Fix import order in migrations - Fix long lines in migration scripts - All ruff checks passing
27 lines
912 B
Python
27 lines
912 B
Python
from datetime import datetime
|
|
from typing import TYPE_CHECKING, List
|
|
|
|
from sqlalchemy import Boolean, Column, DateTime, String
|
|
from sqlalchemy.orm import Mapped, relationship
|
|
|
|
from app.db.base_class import Base
|
|
|
|
if TYPE_CHECKING:
|
|
from app.models.product import Product
|
|
|
|
|
|
class User(Base):
|
|
"""
|
|
Database model for users.
|
|
"""
|
|
id = Column(String, primary_key=True, index=True)
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
full_name = Column(String, nullable=True)
|
|
hashed_password = Column(String, nullable=False)
|
|
is_active = Column(Boolean, default=True)
|
|
is_superuser = Column(Boolean, default=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
# Relationships
|
|
products: Mapped[List["Product"]] = relationship("Product", back_populates="owner") |