Coverage for api/account/schema.py: 100.00%

21 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2026-01-25 13:05 +0000

1from typing import Optional 

2from datetime import datetime 

3from core.config import settings 

4from pydantic import BaseModel, EmailStr, Field 

5 

6class UserProfile(BaseModel): 

7 id: str = Field(..., description="User ID") 

8 first_name: str = Field(..., description="First name") 

9 last_name: str = Field(..., description="Last name") 

10 email: EmailStr = Field(..., description="User email address") 

11 phone: str = Field(..., description="Phone number") 

12 status: bool = Field(..., description="User status") 

13 created_at: datetime = Field(..., description="User creation time") 

14 

15class UserUpdate(BaseModel): 

16 first_name: Optional[str] = Field(None, min_length=1, max_length=50, description="First name") 

17 last_name: Optional[str] = Field(None, min_length=1, max_length=50, description="Last name") 

18 email: Optional[EmailStr] = Field(None, description="User email address") 

19 phone: Optional[str] = Field(None, min_length=1, max_length=20, description="Phone number") 

20 

21class PasswordChange(BaseModel): 

22 current_password: str = Field(..., min_length=settings.PASSWORD_MIN_LENGTH, max_length=50, description="Current password") 

23 new_password: str = Field(..., min_length=settings.PASSWORD_MIN_LENGTH, max_length=50, description="New password") 

24 logout_all_devices: bool = Field(True, description="Logout all devices")