Add app\models\audit.py
Browse files- app//models//audit.py +23 -0
app//models//audit.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
from sqlalchemy import String, DateTime, JSON
|
| 3 |
+
from sqlalchemy.orm import Mapped, mapped_column
|
| 4 |
+
|
| 5 |
+
# Assuming you have a Base class defined somewhere like app.db.base or app.models.base
|
| 6 |
+
from app.models.base import Base
|
| 7 |
+
|
| 8 |
+
class AuditRecord(Base):
|
| 9 |
+
__tablename__ = "audit_records"
|
| 10 |
+
|
| 11 |
+
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
| 12 |
+
|
| 13 |
+
# What was scanned? (e.g., "document_123", "user_query")
|
| 14 |
+
target_id: Mapped[str] = mapped_column(String, index=True)
|
| 15 |
+
|
| 16 |
+
# The action or scan type (e.g., "paraphrase_check", "fact_verify")
|
| 17 |
+
action_type: Mapped[str] = mapped_column(String, index=True)
|
| 18 |
+
|
| 19 |
+
# Store the complex results from VeritasEngine as JSON
|
| 20 |
+
scan_results: Mapped[dict] = mapped_column(JSON, nullable=True)
|
| 21 |
+
|
| 22 |
+
# When did this happen?
|
| 23 |
+
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|