
Features: - User authentication with JWT - Client management with CRUD operations - Invoice generation and management - SQLite database with Alembic migrations - Detailed project documentation
22 lines
864 B
Python
22 lines
864 B
Python
from sqlalchemy import Boolean, Column, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.models.base import ModelBase, TimestampMixin
|
|
|
|
|
|
class User(ModelBase, TimestampMixin):
|
|
"""
|
|
User model
|
|
"""
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
full_name = Column(String, nullable=False)
|
|
company_name = Column(String, nullable=True)
|
|
address = Column(String, nullable=True)
|
|
phone = Column(String, nullable=True)
|
|
is_active = Column(Boolean, default=True)
|
|
|
|
# Relationships
|
|
clients = relationship("Client", back_populates="user", cascade="all, delete-orphan")
|
|
invoices = relationship("Invoice", back_populates="user", cascade="all, delete-orphan")
|
|
activities = relationship("Activity", back_populates="user", cascade="all, delete-orphan") |