forked from mtusi2026/mtusi2026lab2
Copy the committed lab 1 sources as-is: src/, student-tests/, bench/, Dockerfile, docker-compose.yml, pyproject.toml, uv.lock, .python-version, config_example.toml, AGENTS.md, CLAUDE.md, .claude/, openspec/, .graphifyignore and KNOWN_ISSUES.md. Lab 1 evidence stays in the lab 1 repository. Merge the new skeleton files with own sections: Makefile (lab 2 targets plus own run, docker, bench and common targets), .gitignore, .dockerignore and .env.example. Rename the image to mtusi-messenger:lab2 and point AGENTS.md at lab 2. The application is still the in-memory lab 1 implementation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from src.api.schemas.common import NonBlankStr, UtcDatetime
|
|
from src.utils.constants import (
|
|
CHAT_MEMBERS_MAX,
|
|
CHAT_MEMBERS_MIN,
|
|
CHAT_TITLE_MAX_LENGTH,
|
|
CHAT_TITLE_MIN_LENGTH,
|
|
)
|
|
|
|
|
|
class CreateChat(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
title: NonBlankStr = Field(
|
|
min_length=CHAT_TITLE_MIN_LENGTH,
|
|
max_length=CHAT_TITLE_MAX_LENGTH,
|
|
)
|
|
# только форма; повторы, существование и вызывающего в списке
|
|
# проверяет ChatService.create_chat
|
|
member_ids: list[UUID] = Field(
|
|
min_length=CHAT_MEMBERS_MIN,
|
|
max_length=CHAT_MEMBERS_MAX,
|
|
)
|
|
|
|
|
|
class Chat(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: UUID
|
|
title: str
|
|
member_ids: list[UUID]
|
|
created_at: UtcDatetime
|
|
|
|
|
|
class ChatPage(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
items: list[Chat]
|
|
next_cursor: str | None
|