
Features: - User authentication with JWT - Client management with CRUD operations - Invoice generation and management - SQLite database with Alembic migrations - Detailed project documentation
21 lines
769 B
Python
21 lines
769 B
Python
from sqlalchemy import Column, ForeignKey, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.models.base import ModelBase, TimestampMixin
|
|
|
|
|
|
class Client(ModelBase, TimestampMixin):
|
|
"""
|
|
Client model
|
|
"""
|
|
user_id = Column(Integer, ForeignKey("user.id", ondelete="CASCADE"), nullable=False)
|
|
name = Column(String, nullable=False, index=True)
|
|
email = Column(String, nullable=False)
|
|
company_name = Column(String, nullable=True)
|
|
address = Column(String, nullable=True)
|
|
phone = Column(String, nullable=True)
|
|
notes = Column(String, nullable=True)
|
|
|
|
# Relationships
|
|
user = relationship("User", back_populates="clients")
|
|
invoices = relationship("Invoice", back_populates="client", cascade="all, delete-orphan") |