
- Set up project structure with modular organization - Implement database models for users, organizations, clients, invoices - Create Alembic migration scripts for database setup - Implement JWT-based authentication and authorization - Create API endpoints for users, organizations, clients, invoices - Add PDF generation for invoices using ReportLab - Add comprehensive documentation in README
21 lines
847 B
Python
21 lines
847 B
Python
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.base_class import Base
|
|
|
|
class User(Base):
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
full_name = Column(String, index=True)
|
|
is_active = Column(Boolean, default=True)
|
|
is_superuser = Column(Boolean, default=False)
|
|
|
|
# Relationship with Organization
|
|
organization_id = Column(Integer, ForeignKey("organization.id", ondelete="CASCADE"), nullable=True)
|
|
organization = relationship("Organization", back_populates="users")
|
|
|
|
# Relationship with Invoice
|
|
invoices = relationship("Invoice", back_populates="created_by")
|
|
|
|
# Relationship with Client
|
|
clients = relationship("Client", back_populates="created_by") |