This commit is contained in:
Shubhankar45
2026-10-27 12:03:31 +00:00
parent 2ed3945b5d
commit 4e5e95775d
104 changed files with 5210 additions and 606 deletions
+26 -2
View File
@@ -1,7 +1,13 @@
import uuid
from datetime import date
from datetime import date, datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic import BaseModel, ConfigDict, Field, field_validator
def _not_in_future(value: date | None) -> date | None:
if value is not None and value > date.today():
raise ValueError("date_of_birth cannot be in the future")
return value
class DoctorCreate(BaseModel):
@@ -11,8 +17,11 @@ class DoctorCreate(BaseModel):
speciality: str | None = Field(default=None, max_length=100)
qualification: str | None = Field(default=None, max_length=100)
contact_number: str | None = Field(default=None, max_length=20)
date_of_birth: date | None = None
is_core_doctor: bool = False
_check_dob = field_validator("date_of_birth")(_not_in_future)
class DoctorUpdate(BaseModel):
name: str | None = Field(default=None, min_length=2, max_length=200)
@@ -20,9 +29,12 @@ class DoctorUpdate(BaseModel):
speciality: str | None = Field(default=None, max_length=100)
qualification: str | None = Field(default=None, max_length=100)
contact_number: str | None = Field(default=None, max_length=20)
date_of_birth: date | None = None
is_core_doctor: bool | None = None
is_active: bool | None = None
_check_dob = field_validator("date_of_birth")(_not_in_future)
class DoctorRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
@@ -34,10 +46,22 @@ class DoctorRead(BaseModel):
speciality: str | None
qualification: str | None
contact_number: str | None
date_of_birth: date | None
is_core_doctor: bool
is_active: bool
#: PENDING / APPROVED / REJECTED — see app/common/master_approval.py.
approval_status: str
rejection_reason: str | None
requested_by_name: str | None
created_at: datetime
class AssignToMR(BaseModel):
mr_user_id: uuid.UUID
effective_from: date | None = None
class RejectMaster(BaseModel):
"""Why the Area Manager refused a doctor or chemist an MR added — shown to that MR."""
reason: str = Field(min_length=3, max_length=500)