- carry the lab 3 solution over from mtusi2026lab3-safronov (solution/bvt2301-safronov, ce89eba): src, migrations, student-tests, bench, openspec, .claude, infra/haproxy and infra/valkey, own scripts, Dockerfile, compose, pyproject and uv lock - merge Makefile, .gitignore and .dockerignore (the lab 3 versions only add lines to the skeleton, which is the same in lab 4) and .env.example (lab 4 skeleton names listed in the header) - rename the compose project to mtusi-lab4 and the image to :lab4 so the stand does not reuse the lab 3 containers and volumes - update AGENTS.md for lab 4: current lab, origin commit, contract and test files of the new skeleton Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
856 B
Python
38 lines
856 B
Python
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from src.api.schemas.common import NonBlankStr, UtcDatetime
|
|
from src.utils.constants import (
|
|
MESSAGE_TEXT_MAX_LENGTH,
|
|
MESSAGE_TEXT_MIN_LENGTH,
|
|
)
|
|
|
|
|
|
class CreateMessage(BaseModel):
|
|
"""Отправитель берётся из идентификации; поле sender_id — 400."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
text: NonBlankStr = Field(
|
|
min_length=MESSAGE_TEXT_MIN_LENGTH,
|
|
max_length=MESSAGE_TEXT_MAX_LENGTH,
|
|
)
|
|
|
|
|
|
class Message(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: UUID
|
|
chat_id: UUID
|
|
sender_id: UUID
|
|
text: str
|
|
created_at: UtcDatetime
|
|
|
|
|
|
class MessagePage(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
items: list[Message]
|
|
next_cursor: str | None
|