Files
chat/services/user_service/emergency_contact_schema.py
Andrew K. Choi dd7349bb4c
All checks were successful
continuous-integration/drone/push Build is passing
fixes
2025-09-25 15:32:19 +09:00

46 lines
1.3 KiB
Python

from typing import Optional
from uuid import UUID
from pydantic import BaseModel, Field
class EmergencyContactBase(BaseModel):
name: str = Field(..., min_length=1, max_length=100)
phone_number: str = Field(..., min_length=5, max_length=20)
relationship: Optional[str] = Field(None, max_length=50)
notes: Optional[str] = Field(None, max_length=500)
class EmergencyContactCreate(EmergencyContactBase):
pass
class EmergencyContactUpdate(BaseModel):
name: Optional[str] = Field(None, min_length=1, max_length=100)
phone_number: Optional[str] = Field(None, min_length=5, max_length=20)
relationship: Optional[str] = Field(None, max_length=50)
notes: Optional[str] = Field(None, max_length=500)
class EmergencyContactResponse(EmergencyContactBase):
id: int
uuid: UUID
user_id: int
model_config = {
"from_attributes": True,
"populate_by_name": True,
"json_schema_extra": {
"examples": [
{
"name": "John Doe",
"phone_number": "+1234567890",
"relationship": "Father",
"notes": "Call in case of emergency",
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"user_id": 1,
}
]
}
}