From 61af375c0e193ef58ac1f5fdb3a6dcb9659a050d Mon Sep 17 00:00:00 2001 From: quaduzi Date: Fri, 30 Jun 2023 13:44:10 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=B2=D0=BE=D0=B1=D0=BE=D0=B4=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D1=81=D0=BB=D0=BE=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.py b/src/main.py index 4c791bb..604c5f5 100644 --- a/src/main.py +++ b/src/main.py @@ -148,6 +148,20 @@ def create_calendar_slots(datetime_start: datetime, timezone: str, slot_length_m return events +@app.post('/calendar_events/busy', response_model=List[CalendarEvent]) +def mark_busy_calendar_slot( + lower_bound: datetime = None, + upper_bound: datetime = None, + service: Resource = Depends(get_calendar_service) +): + events_dict = get_calendar_events(lower_bound=lower_bound, upper_bound=upper_bound, service=service) + events = list(map(lambda x: CalendarEvent(**x), events_dict)) + + free_slots = list(filter(lambda x: x.summary == TITLE_FREE if x.summary else False, events)) + + return free_slots + + @app.post('/calendar_events/mark_busy', response_model=CalendarEvent) def mark_busy_calendar_slot( description: str | None = None,