
- 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
26 lines
933 B
Python
26 lines
933 B
Python
from sqlalchemy import Column, String, Text, ForeignKey, Integer
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.base_class import Base
|
|
|
|
class Client(Base):
|
|
name = Column(String, index=True, nullable=False)
|
|
contact_name = Column(String)
|
|
email = Column(String)
|
|
phone = Column(String)
|
|
address = Column(Text)
|
|
city = Column(String)
|
|
state = Column(String)
|
|
postal_code = Column(String)
|
|
country = Column(String)
|
|
tax_id = Column(String)
|
|
notes = Column(Text)
|
|
|
|
# Foreign keys
|
|
organization_id = Column(Integer, ForeignKey("organization.id", ondelete="CASCADE"))
|
|
created_by_id = Column(Integer, ForeignKey("user.id", ondelete="SET NULL"), nullable=True)
|
|
|
|
# Relationships
|
|
organization = relationship("Organization", back_populates="clients")
|
|
created_by = relationship("User", back_populates="clients")
|
|
invoices = relationship("Invoice", back_populates="client") |