first commit
This commit is contained in:
2
backend/app/repositories/native/__init__.py
Normal file
2
backend/app/repositories/native/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
"""Native repositories for FastAPI-owned system data."""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24
backend/app/repositories/native/audit_logs.py
Normal file
24
backend/app/repositories/native/audit_logs.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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:]
|
||||
|
||||
24
backend/app/repositories/native/editor_sessions.py
Normal file
24
backend/app/repositories/native/editor_sessions.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.domain.editor import EditorSession
|
||||
|
||||
|
||||
class EditorSessionRepository:
|
||||
"""Temporary in-memory repository for editor sessions."""
|
||||
|
||||
_sessions: dict[str, EditorSession] = {}
|
||||
|
||||
async def create(self, session: EditorSession) -> EditorSession:
|
||||
self._sessions[session.id] = session
|
||||
return session
|
||||
|
||||
async def get(self, session_id: str) -> EditorSession | None:
|
||||
return self._sessions.get(session_id)
|
||||
|
||||
async def update(self, session: EditorSession) -> EditorSession:
|
||||
self._sessions[session.id] = session
|
||||
return session
|
||||
|
||||
async def delete(self, session_id: str) -> None:
|
||||
self._sessions.pop(session_id, None)
|
||||
|
||||
19
backend/app/repositories/native/system_events.py
Normal file
19
backend/app/repositories/native/system_events.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from app.domain.observability import SystemEvent
|
||||
|
||||
|
||||
class SystemEventRepository:
|
||||
"""Temporary event repository for runtime/system telemetry."""
|
||||
|
||||
_events: list[SystemEvent] = []
|
||||
|
||||
async def add(self, event: SystemEvent) -> SystemEvent:
|
||||
self._events.append(event)
|
||||
return event
|
||||
|
||||
async def list_recent(self, limit: int = 100) -> Sequence[SystemEvent]:
|
||||
return self._events[-limit:]
|
||||
|
||||
Reference in New Issue
Block a user