예제 #1
0
def get_all_reservations_by_user_id(user_id):
    with session_scope() as session:
        reservations = session.query(Reservation) \
            .filter(Reservation.user_id == user_id) \
            .with_entities(Reservation.reservation_id) \
            .all()
    return reservations
예제 #2
0
def remove_reservation(reservation_id):
    with session_scope() as session:
        session.query(Reservation).filter(
            Reservation.reservation_id == reservation_id).delete(
                synchronize_session=False)
def get_movie_projections_by_movie_id_and_date(movie_id, date):
    with session_scope() as session:
        projections = session.query(Projection). \
            filter(Projection.movie_id == movie_id). \
            filter(Projection.projection_date == date).all()
    return projections
예제 #4
0
def get_movies():
    with session_scope() as session:
        movies = session.query(Movie).all()
    return movies
def get_movie_projections_by_movie_id(movie_id):
    with session_scope() as session:
        projections = session.query(Projection).filter(
            Projection.movie_id == movie_id).all()
    return projections
예제 #6
0
def check_user_name_already_exists(user_name):
    with session_scope() as session:
        user_names = session.query(User).filter(User.user_name == user_name).all()
    return user_names
예제 #7
0
def add_user_to_database(user):
    with session_scope() as session:
        session.add(user)
예제 #8
0
def get_user(user_name, hashed_password):
    with session_scope() as session:
        user_info = session.query(User).filter(User.user_name == user_name). \
            filter(User.user_password == hashed_password).all()
    return user_info
예제 #9
0
def get_reservations_by_user_id(user_id):
    with session_scope() as session:
        reservations = session.query(Reservation).filter(
            Reservation.user_id == user_id).all()
    return reservations