Automated Action b51b13eb3e Create backend scaffold for freelancer invoicing API
- 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
2025-05-26 18:21:20 +00:00

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")