Skip to content

Commit

Permalink
bugfix reserve.py
Browse files Browse the repository at this point in the history
  • Loading branch information
WSL0809 committed May 26, 2024
1 parent f5c6762 commit 3e2590a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/reserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from auth import get_current_active_user
from auth_schema import User
from database import get_db
from config import RoomStatus
from config import RoomStatus, ClientTag

router = APIRouter()
occupied = RoomStatus.Occupied.value
Expand All @@ -39,6 +39,7 @@ class ReserveRecv(BaseModel):
meal_plan_seller: Union[Dict, None] = {}
recovery_plan_seller: Union[Dict, None] = {}
due_date: Union[str, None] = None
status: str

class Config:
orm_mode = True
Expand All @@ -52,10 +53,11 @@ class ReserveResp(BaseModel):
@exception_handler
def update_client_and_room(db, reserve_recv: ReserveRecv):
# db_client = model.Client(**reserve_recv.dict())
reserve_recv["status"] = f'{reserve_recv["status"]}-{ClientTag.reversed_room}'
create_client_sql = text(
"""
INSERT INTO client (name, tel, age, scheduled_date, check_in_date, hospital_for_childbirth, contact_name, contact_tel, mode_of_delivery, room, meal_plan_id, recovery_plan_id, assigned_baby_nurse, id_number, status, meal_plan_seller, recovery_plan_seller, due_date)
VALUES (:name, :tel, :age, :scheduled_date, :check_in_date, :hospital_for_childbirth, :contact_name, :contact_tel, :mode_of_delivery, :room, :meal_plan_id, :recovery_plan_id, :assigned_baby_nurse, :id_number, 0, :meal_plan_seller, :recovery_plan_seller, :due_date)
VALUES (:name, :tel, :age, :scheduled_date, :check_in_date, :hospital_for_childbirth, :contact_name, :contact_tel, :mode_of_delivery, :room, :meal_plan_id, :recovery_plan_id, :assigned_baby_nurse, :id_number, :status, :meal_plan_seller, :recovery_plan_seller, :due_date)
RETURNING id
"""
)
Expand Down

0 comments on commit 3e2590a

Please sign in to comment.