Files
Messenger/app/auth/schemas.py
benya 456595a576
Some checks failed
CI / test (push) Failing after 17s
feat: add user display profiles and fix web context menu UX
backend:

- add required user name and optional bio fields

- extend auth/register and user schemas/services with name/bio

- add alembic migration 0006 with safe backfill name=username

- compute per-user chat display_title for private chats

- keep Saved Messages delete-for-all protections

web:

- registration now includes name

- add profile edit modal (name/username/bio/avatar url)

- show private chat names via display_title

- fix context menus to open near cursor with viewport clamping

- stabilize +/close floating button to remove visual jump
2026-03-08 00:57:02 +03:00

61 lines
1.3 KiB
Python

from datetime import datetime
from pydantic import BaseModel, ConfigDict, EmailStr, Field
class RegisterRequest(BaseModel):
email: EmailStr
name: str = Field(min_length=1, max_length=100)
username: str = Field(min_length=3, max_length=50)
password: str = Field(min_length=8, max_length=128)
class LoginRequest(BaseModel):
email: EmailStr
password: str = Field(min_length=8, max_length=128)
class RefreshTokenRequest(BaseModel):
refresh_token: str = Field(min_length=16)
class VerifyEmailRequest(BaseModel):
token: str = Field(min_length=16, max_length=512)
class ResendVerificationRequest(BaseModel):
email: EmailStr
class RequestPasswordResetRequest(BaseModel):
email: EmailStr
class ResetPasswordRequest(BaseModel):
token: str = Field(min_length=16, max_length=512)
new_password: str = Field(min_length=8, max_length=128)
class MessageResponse(BaseModel):
message: str
class TokenResponse(BaseModel):
access_token: str
refresh_token: str
token_type: str = "bearer"
class AuthUserResponse(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
email: EmailStr
name: str
username: str
bio: str | None = None
avatar_url: str | None = None
email_verified: bool
created_at: datetime
updated_at: datetime