Files
mtusi2026lab4-fork/messenger/repository.py
T
nothingredmouth 4b23b44eb8 Перенести приложение мессенджера с сессиями и идемпотентностью в PostgreSQL
Пользователи, аутентификация Argon2id, Bearer-сессии с TTL и отзывом,
транзакционный репозиторий, keyset-пагинация, идемпотентные отправки
(advisory lock + message_requests), версияемые миграции 001/002.
2026-11-17 03:37:07 +00:00

18 lines
714 B
Python

"""Storage port. Concrete PostgreSQL adapter is wired in api.create_app."""
from typing import Protocol
class Repository(Protocol):
def ready(self): ...
def cursor_key(self): ...
def create_user(self, username, display_name, password_hash): ...
def credentials(self, username): ...
def create_session(self, user_id, token_hash, ttl): ...
def session_user(self, token_hash): ...
def revoke_session(self, token_hash): ...
def create_chat(self, actor, title, members): ...
def chat(self, actor, chat_id): ...
def chats(self, actor, limit, after): ...
def create_message(self, actor, chat_id, text, key, ttl): ...
def messages(self, actor, chat_id, limit, after): ...