44 lines
894 B
Python
44 lines
894 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class DoctorBase(BaseModel):
|
|
specialty: Optional[str] = None
|
|
license_number: Optional[str] = None
|
|
experience_years: Optional[int] = None
|
|
bio: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class DoctorCreate(DoctorBase):
|
|
user_id: int
|
|
specialty: str
|
|
license_number: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class DoctorUpdate(DoctorBase):
|
|
pass
|
|
|
|
|
|
class DoctorInDBBase(DoctorBase):
|
|
id: Optional[int] = None
|
|
user_id: int
|
|
created_at: Optional[datetime] = None
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class Doctor(DoctorInDBBase):
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class DoctorInDB(DoctorInDBBase):
|
|
pass |