- Added monitoring metrics for project creation success and error handling in `ProjectRepository`. - Implemented similar monitoring for scenario creation in `ScenarioRepository`. - Refactored `run_monte_carlo` function in `simulation.py` to include timing and success/error metrics. - Introduced new CSS styles for headers, alerts, and navigation buttons in `main.css` and `projects.css`. - Created a new JavaScript file for navigation logic to handle chevron buttons. - Updated HTML templates to include new navigation buttons and improved styling for buttons. - Added tests for reporting service and routes to ensure proper functionality and access control. - Removed unused imports and optimized existing test files for better clarity and performance.
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.sql import func
|
|
|
|
from config.database import Base
|
|
|
|
|
|
class ImportExportLog(Base):
|
|
"""Audit log for import and export operations."""
|
|
|
|
__tablename__ = "import_export_logs"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
action = Column(String(32), nullable=False) # preview, commit, export
|
|
dataset = Column(String(32), nullable=False) # projects, scenarios, etc.
|
|
status = Column(String(16), nullable=False) # success, failure
|
|
filename = Column(String(255), nullable=True)
|
|
row_count = Column(Integer, nullable=True)
|
|
detail = Column(Text, nullable=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
|
created_at = Column(
|
|
DateTime(timezone=True), nullable=False, server_default=func.now()
|
|
)
|
|
|
|
def __repr__(self) -> str: # pragma: no cover
|
|
return (
|
|
f"ImportExportLog(id={self.id}, action={self.action}, "
|
|
f"dataset={self.dataset}, status={self.status})"
|
|
)
|