def add_available_date(selected_cage, start_date, days):
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    cage = Cage.objects(id=selected_cage.id).first()
    cage.bookings.append(booking)
    cage.save()
Ejemplo n.º 2
0
def add_available_date(cage: Cage, start_date: datetime.datetime,
                       days: int):  # -> Cage:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    # cage = Cage.objects(id=cage.id.first())
    cage.bookings.append(booking)
    cage.save()
Ejemplo n.º 3
0
def add_available_date(selected_cage: Cage, start_date: datetime, days: int) -> Cage:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + timedelta(days=days)

    cage = Cage.objects(id=selected_cage.id).first()  # pylint: disable=no-member
    cage.bookings.append(booking)
    cage.save()

    return cage
Ejemplo n.º 4
0
def update_room_availability_date(room: Room, start_date: datetime,
                                  num_days: int) -> Room:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + timedelta(days=num_days)

    selected_room = find_room_by_number(room.number)
    selected_room.bookings.append(booking)
    selected_room.save()
    return selected_room
Ejemplo n.º 5
0
def add_available_date(cage: Cage,
                       start_date: datetime.datetime, days: int) -> Cage:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    cage = Cage.objects(id=cage.id).first() #get the cage
    cage.bookings.append(booking) #booking is added to cage as it as embedded document
    cage.save()

    return cage
def add_available_date(selectedcage: Cage, start_date: datetime.datetime,
                       duration: int):
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=duration)

    cage = Cage.objects(id=selectedcage.id).first()
    cage.bookings.append(booking)
    cage.save()

    return cage
Ejemplo n.º 7
0
def add_available_date(studio: Studio,
                       start_date: datetime.datetime, hours: int) -> Studio:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(hours=hours)

    studio = Studio.objects(id=studio.id).first()
    studio.bookings.append(booking)
    studio.save()

    return studio
Ejemplo n.º 8
0
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 add_available_date(room: Room, start_date: datetime.datetime,
                       days: int) -> Room:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    room = Room.objects(id=room.id).first()
    room.bookings.append(booking)
    room.save()

    return room
def add_available_date(cage: Cage,
                       start_date: datetime.datetime, days: int) -> Cage:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    cage = Cage.objects(id=cage.id).first()
    cage.bookings.append(booking)
    cage.save()

    return cage
Ejemplo n.º 11
0
def add_date(cage: Cage, start_date: datetime.datetime, days: int):
    booking = Booking()

    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    cage = Cage.objects(id=cage.id).first()
    cage.bookings.append(booking)
    cage.save()

    return cage
Ejemplo n.º 12
0
def add_available_date(shelter: Shelter,
                       start_date: datetime.datetime, days: int) -> Shelter:
    booking = Booking()
    booking.check_in_date = start_date
    booking.check_out_date = start_date + datetime.timedelta(days=days)

    shelter = Shelter.objects(id=shelter.id).first()
    shelter.bookings.append(booking)
    shelter.save()

    return shelter
Ejemplo n.º 13
0
def book_cage(account: Owner, snake: Snake, cage: Cage,
              checkin: datetime.datetime, checkout: datetime.datetime):
    booking = Booking()

    booking.guest_owner_id = account.id
    booking.guest_snake_id = snake.id
    booking.booked_date = datetime.datetime.now()
    booking.check_in_date = checkin
    booking.check_out_date = checkout

    cage = Cage.objects(id=cage.id).first()
    cage.bookings.append(booking)

    cage.save()
Ejemplo n.º 14
0
 def map_cage_to_booking(cage: Cage, booking: Booking) -> Booking:
     booking.cage = cage
     return booking