username validation

This commit is contained in:
IluaAir
2025-09-20 14:11:14 +03:00
parent c642b89581
commit 9099120ee2
2 changed files with 14 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ from typing import Annotated
from pydantic import BaseModel, BeforeValidator, ConfigDict, EmailStr
from src.schemas.tasks import TaskWithId
from src.schemas.validators import ensure_password
from src.schemas.validators import ensure_password, ensure_username
class UserUpdate(BaseModel):
@@ -38,7 +38,7 @@ class UserRequest(BaseModel):
class UserRequestADD(BaseModel):
username: str
username: Annotated[str, BeforeValidator(ensure_username)]
email: EmailStr | None = None
password: Annotated[str, BeforeValidator(ensure_password)]