def add_available_date(event: Event, start_date: datetime.datetime, tiime: int) -> Event: booking = Booking() booking.check_in_time = start_date booking.check_out_time = start_date + datetime.timedelta(minutes=tiime) event = Event.objects(id=event.id).first() event.bookings.append(booking) event.save() return event
def register_event(active_account: Owner, name, allow_non_friends, in_public_place, in_outdoors, duration_minutes, rating_price, location) -> Event: event = Event() event.name = name event.location = location event.duration_minutes = duration_minutes event.in_public_place = in_public_place event.in_outdoors = in_outdoors event.allow_non_friends = allow_non_friends event.rating_price = rating_price event.save() account = find_account_by_email(active_account.email) account.event_ids.append(event.id) account.save() return event