feat(account): GET /me user endpoint only, disable cache and extra routers
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
17
src/presentation/schemas/phone.py
Normal file
17
src/presentation/schemas/phone.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import re
|
||||
from pydantic import BaseModel, field_validator
|
||||
from src.application.domain.exceptions import ApplicationException
|
||||
|
||||
|
||||
class SetPhoneRequest(BaseModel):
|
||||
phone: str
|
||||
|
||||
@field_validator('phone')
|
||||
@classmethod
|
||||
def validate_russian_phone(cls, v: str) -> str:
|
||||
cleaned = re.sub(r'[\s\-\(\)]', '', v)
|
||||
pattern = r'^(\+7|8)\d{10}$'
|
||||
if not re.match(pattern, cleaned):
|
||||
raise ApplicationException(message='Invalid Russian phone number', status_code=429)
|
||||
normalized = '+7' + cleaned[-10:]
|
||||
return normalized
|
||||
Reference in New Issue
Block a user