Improve the frontend and fix TODOs
This commit is contained in:
@@ -6,7 +6,7 @@ User schemas
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, EmailStr, Field, validator
|
||||
from typing import Optional
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
|
||||
from shared.utils.validation import validate_spanish_phone
|
||||
@@ -17,7 +17,7 @@ class UserUpdate(BaseModel):
|
||||
phone: Optional[str] = None
|
||||
language: Optional[str] = Field(None, pattern="^(es|en)$")
|
||||
timezone: Optional[str] = None
|
||||
|
||||
|
||||
@validator('phone')
|
||||
def validate_phone(cls, v):
|
||||
"""Validate phone number"""
|
||||
@@ -40,3 +40,24 @@ class UserProfile(BaseModel):
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
class BatchUserRequest(BaseModel):
|
||||
"""Request schema for batch user fetch"""
|
||||
user_ids: List[str] = Field(..., description="List of user IDs to fetch", min_items=1, max_items=100)
|
||||
|
||||
class OwnerUserCreate(BaseModel):
|
||||
"""Schema for owner-created users (pilot phase)"""
|
||||
email: EmailStr = Field(..., description="User email address")
|
||||
full_name: str = Field(..., min_length=2, max_length=100, description="Full name of the user")
|
||||
password: str = Field(..., min_length=8, max_length=128, description="Initial password for the user")
|
||||
phone: Optional[str] = Field(None, description="Phone number")
|
||||
role: str = Field("user", pattern="^(user|admin|manager)$", description="User role in the system")
|
||||
language: Optional[str] = Field("es", pattern="^(es|en|eu)$", description="Preferred language")
|
||||
timezone: Optional[str] = Field("Europe/Madrid", description="User timezone")
|
||||
|
||||
@validator('phone')
|
||||
def validate_phone_number(cls, v):
|
||||
"""Validate phone number"""
|
||||
if v and not validate_spanish_phone(v):
|
||||
raise ValueError('Invalid Spanish phone number format')
|
||||
return v
|
||||
|
||||
Reference in New Issue
Block a user