forked from cardosofelipe/fast-next-template
- Introduced `pyproject.toml` to centralize backend tool configurations (e.g., Ruff, mypy, coverage, pytest). - Replaced Black, isort, and Flake8 with Ruff for linting, formatting, and import sorting. - Updated `requirements.txt` to include Ruff and remove replaced tools. - Added `Makefile` to streamline development workflows with commands for linting, formatting, type-checking, testing, and cleanup.
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from sqlalchemy import Boolean, Column, DateTime, String
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from .base import Base, TimestampMixin, UUIDMixin
|
|
|
|
|
|
class User(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "users"
|
|
|
|
email = Column(String(255), unique=True, nullable=False, index=True)
|
|
password_hash = Column(String(255), nullable=False)
|
|
first_name = Column(String(100), nullable=False, default="user")
|
|
last_name = Column(String(100), nullable=True)
|
|
phone_number = Column(String(20))
|
|
is_active = Column(Boolean, default=True, nullable=False, index=True)
|
|
is_superuser = Column(Boolean, default=False, nullable=False, index=True)
|
|
preferences = Column(JSONB)
|
|
deleted_at = Column(DateTime(timezone=True), nullable=True, index=True)
|
|
|
|
# Relationships
|
|
user_organizations = relationship(
|
|
"UserOrganization", back_populates="user", cascade="all, delete-orphan"
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<User {self.email}>"
|