Full-stack Amazon AI Transcreation Platform with: - FastAPI backend (async, PostgreSQL, Redis, Celery) with 11 DB tables - JWT auth (SSO-ready abstract provider pattern) - 6-agent pipeline orchestrator with deterministic modules - Next.js 14 frontend with Amazon branding (Ember fonts, orange/dark theme) - Job wizard, monitoring HUD, output review, admin screens - 154 TM/reference files imported, 12 locales configured - Docker Compose for all services Agents 2-5 (TM retrieval, ranker, transcreator, compliance) are stubs pending Phase 3 LLM integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
2 KiB
Python
56 lines
2 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, Float, ForeignKey, Integer, JSON, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.models.base import Base, generate_uuid
|
|
|
|
|
|
class AuditLog(Base):
|
|
__tablename__ = "audit_logs"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
primary_key=True, default=generate_uuid
|
|
)
|
|
user_id: Mapped[uuid.UUID | None] = mapped_column(
|
|
ForeignKey("users.id"), nullable=True
|
|
)
|
|
action: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
entity_type: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
entity_id: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
details: Mapped[dict | None] = mapped_column(JSON, nullable=True)
|
|
timestamp: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True),
|
|
server_default=func.now(),
|
|
nullable=False,
|
|
)
|
|
ip_address: Mapped[str | None] = mapped_column(String(45), nullable=True)
|
|
|
|
# Relationships
|
|
user = relationship("User", back_populates="audit_logs")
|
|
|
|
|
|
class TokenUsageLog(Base):
|
|
__tablename__ = "token_usage_logs"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
primary_key=True, default=generate_uuid
|
|
)
|
|
instance_id: Mapped[uuid.UUID] = mapped_column(
|
|
ForeignKey("locale_instances.id", ondelete="CASCADE"), nullable=False
|
|
)
|
|
agent_name: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
model: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
input_tokens: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
output_tokens: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
total_tokens: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
estimated_cost_usd: Mapped[float] = mapped_column(Float, nullable=False)
|
|
timestamp: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True),
|
|
server_default=func.now(),
|
|
nullable=False,
|
|
)
|
|
|
|
# Relationships
|
|
instance = relationship("LocaleInstance", back_populates="token_usage_logs")
|