
- Set up FastAPI application with CORS support - Configure SQLite database connection - Create database models for users, clients, invoices, and line items - Set up Alembic for database migrations - Implement JWT-based authentication system - Create basic CRUD endpoints for users, clients, and invoices - Add PDF generation functionality - Implement activity logging - Update README with project information
18 lines
751 B
Python
18 lines
751 B
Python
from sqlalchemy import Column, String, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
import uuid
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Client(Base):
|
|
id = Column(String, primary_key=True, index=True, default=lambda: str(uuid.uuid4()))
|
|
name = Column(String, index=True, nullable=False)
|
|
email = Column(String, index=True, nullable=False)
|
|
company = Column(String, nullable=True)
|
|
address = Column(String, nullable=True)
|
|
phone = Column(String, nullable=True)
|
|
user_id = Column(String, ForeignKey("user.id", ondelete="CASCADE"), nullable=False)
|
|
|
|
# Relationships
|
|
user = relationship("User", back_populates="clients")
|
|
invoices = relationship("Invoice", back_populates="client", cascade="all, delete-orphan") |