Преглед изворни кода

Add checkin_time and checkout_time to reservation API response

ZiB пре 4 месеци
родитељ
комит
076bb1b5c1
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      room_cal/api/_routes/reservations.py

+ 2 - 0
room_cal/api/_routes/reservations.py

@@ -11,6 +11,8 @@ def _enrich(ev) -> dict:
   xd = safe_json_loads(ev.x_data) or {}
   xd = safe_json_loads(ev.x_data) or {}
   xd['checkin_date'] = ev.start.date().isoformat()
   xd['checkin_date'] = ev.start.date().isoformat()
   xd['checkout_date'] = ev.end.date().isoformat()
   xd['checkout_date'] = ev.end.date().isoformat()
+  xd['checkin_time'] = ev.start.strftime('%H:%M')
+  xd['checkout_time'] = ev.end.strftime('%H:%M')
   return xd
   return xd