56 lines
1.2 KiB
Python
56 lines
1.2 KiB
Python
from datetime import datetime, time
|
|
from typing import Optional
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class WeekDay(str, Enum):
|
|
MONDAY = "monday"
|
|
TUESDAY = "tuesday"
|
|
WEDNESDAY = "wednesday"
|
|
THURSDAY = "thursday"
|
|
FRIDAY = "friday"
|
|
SATURDAY = "saturday"
|
|
SUNDAY = "sunday"
|
|
|
|
|
|
# Shared properties
|
|
class DoctorScheduleBase(BaseModel):
|
|
day_of_week: Optional[WeekDay] = None
|
|
start_time: Optional[time] = None
|
|
end_time: Optional[time] = None
|
|
is_available: Optional[bool] = True
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class DoctorScheduleCreate(DoctorScheduleBase):
|
|
doctor_id: int
|
|
day_of_week: WeekDay
|
|
start_time: time
|
|
end_time: time
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class DoctorScheduleUpdate(DoctorScheduleBase):
|
|
pass
|
|
|
|
|
|
class DoctorScheduleInDBBase(DoctorScheduleBase):
|
|
id: Optional[int] = None
|
|
doctor_id: int
|
|
created_at: Optional[datetime] = None
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class DoctorSchedule(DoctorScheduleInDBBase):
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class DoctorScheduleInDB(DoctorScheduleInDBBase):
|
|
pass |