first commit
This commit is contained in:
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)
|
||||
|
||||
Reference in New Issue
Block a user