init commit: create skeleton from lab1
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from collections.abc import Collection
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models.user import User
|
||||
|
||||
|
||||
def create_user(
|
||||
session: Session,
|
||||
*,
|
||||
username: str,
|
||||
display_name: str,
|
||||
password_hash: str,
|
||||
) -> User:
|
||||
"""INSERT пользователя и session.flush().
|
||||
|
||||
Нарушение UNIQUE(username) поднимется здесь как sqlalchemy.exc.IntegrityError —
|
||||
перехватывает его domain.users.register_user и превращает в 409.
|
||||
"""
|
||||
raise NotImplementedError("TODO")
|
||||
|
||||
|
||||
def get_user_by_id(session: Session, user_id: UUID) -> User | None:
|
||||
raise NotImplementedError("TODO")
|
||||
|
||||
|
||||
def get_user_by_username(session: Session, username: str) -> User | None:
|
||||
raise NotImplementedError("TODO")
|
||||
|
||||
|
||||
def get_existing_user_ids(session: Session, user_ids: Collection[UUID]) -> set[UUID]:
|
||||
"""Какие из user_ids реально существуют — ОДНИМ запросом (WHERE id IN (...)).
|
||||
|
||||
Нужно для проверки member_ids при создании чата (без цикла из N запросов).
|
||||
"""
|
||||
raise NotImplementedError("TODO")
|
||||
Reference in New Issue
Block a user