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
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
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
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
def add_user_to_database(user): with session_scope() as session: session.add(user)
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
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