diff --git a/schemas/user.py b/schemas/user.py index 7070109..6340d35 100644 --- a/schemas/user.py +++ b/schemas/user.py @@ -1,22 +1,22 @@ -from pydantic import BaseModel, Field, EmailStr +from pydantic import BaseModel, EmailStr, Field from typing import Optional from datetime import datetime class UserBase(BaseModel): first_name: str = Field(..., min_length=2, max_length=50) - last_name: str = Field(..., min_length=2, max_length=50) - email: EmailStr = Field(..., description="User's email address") + last_name: str = Field(..., min_length=2, max_length=50) + email: EmailStr = Field(..., description="User email address") role: str = Field(default="student") - grade_level: Optional[int] = Field(None) - student_id: str = Field(..., min_length=5, max_length=20) - phone_number: Optional[str] = Field(None, max_length=20) - address: Optional[str] = Field(None, max_length=200) + grade_level: Optional[int] = None + student_id: Optional[str] = None + phone_number: Optional[str] = None + address: Optional[str] = None date_of_birth: Optional[datetime] = None profile_picture: Optional[str] = None class UserCreate(UserBase): password: str = Field(..., min_length=8, max_length=100) - + class Config: schema_extra = { "example": { @@ -24,12 +24,13 @@ class UserCreate(UserBase): "last_name": "Doe", "email": "john.doe@example.com", "password": "securepass123", - "student_id": "STU123456", + "role": "student", "grade_level": 10, - "phone_number": "+1234567890", - "address": "123 Main St, City, Country", + "student_id": "STU123", + "phone_number": "123-456-7890", + "address": "123 Main St", "date_of_birth": "2000-01-01T00:00:00", - "profile_picture": "https://example.com/profile.jpg" + "profile_picture": "profile.jpg" } } @@ -47,12 +48,12 @@ class UserResponse(UserBase): "last_name": "Doe", "email": "john.doe@example.com", "role": "student", - "student_id": "STU123456", "grade_level": 10, - "phone_number": "+1234567890", - "address": "123 Main St, City, Country", + "student_id": "STU123", + "phone_number": "123-456-7890", + "address": "123 Main St", "date_of_birth": "2000-01-01T00:00:00", - "profile_picture": "https://example.com/profile.jpg", + "profile_picture": "profile.jpg", "is_active": True, "last_login": "2023-01-01T12:00:00" }