
Features: - User authentication with JWT - Client management with CRUD operations - Invoice generation and management - SQLite database with Alembic migrations - Detailed project documentation
19 lines
748 B
Python
19 lines
748 B
Python
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.models.base import ModelBase
|
|
|
|
|
|
class Activity(ModelBase):
|
|
"""
|
|
Activity model for tracking user actions
|
|
"""
|
|
user_id = Column(Integer, ForeignKey("user.id", ondelete="CASCADE"), nullable=False)
|
|
action = Column(String, nullable=False) # create, update, delete, view
|
|
entity_type = Column(String, nullable=False) # client, invoice, etc.
|
|
entity_id = Column(Integer, nullable=True) # ID of the entity
|
|
details = Column(Text, nullable=True) # Additional details
|
|
timestamp = Column(DateTime, nullable=False)
|
|
|
|
# Relationships
|
|
user = relationship("User", back_populates="activities") |