Добавил отображение свободных слотов

This commit is contained in:
quaduzi 2023-06-30 13:44:10 +07:00
parent 9243eeb536
commit 61af375c0e
1 changed files with 14 additions and 0 deletions

View File

@ -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,