username validation
This commit is contained in:
@@ -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)]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user