Files
mkt.ose.tw/backend/app/repositories/native/audit_logs.py
2026-03-23 20:23:58 +08:00

25 lines
713 B
Python

from __future__ import annotations
from collections.abc import Sequence
from app.domain.observability import AuditLogEntry
class AuditLogRepository:
"""Temporary in-process audit repository.
This keeps the service and data shape stable while we decide the final
native table/migration layout. It should later be replaced by a PostgreSQL-
backed implementation without changing the application layer API.
"""
_entries: list[AuditLogEntry] = []
async def add(self, entry: AuditLogEntry) -> AuditLogEntry:
self._entries.append(entry)
return entry
async def list_recent(self, limit: int = 100) -> Sequence[AuditLogEntry]:
return self._entries[-limit:]