def create(movie_id, movie_type, date, time): projection = Projection(movie_id=movie_id, type=movie_type, date=date, time=time) session.add(projection) session.commit()
def add_movies(): session.add_all([ Movie(name="The Hunger Games: Catching Fire", rating=7.5), Movie(name="Wreck-It Ralph", rating=7.8), Movie(name="Her", rating=8.3), Movie(name="Avengers: Infinity War", rating=8.8)]) session.commit()
def create(name, rating): if rating < LOW_MOVIE_RATING or rating > HIGH_MOVIE_RATING: raise MovieRatingOutOfRangeError() else: movie = Movie(name=name, rating=rating) session.add(movie) session.commit()
def add_projections(): session.add_all([Projection(movie_id=1, type="3D", date="2018-05-25", time="21:55:00"), Projection(movie_id=1, type="4DX", date="2018-05-27", time="21:55:00"), Projection(movie_id=1, type="2D", date="2018-05-26", time="15:30:00"), Projection(movie_id=1, type="3D", date="2018-05-25", time="21:30:00")]) session.commit()
def log_out(user_id): user = session.query(User).filter(User.id == user_id).one_or_none() user.is_active = 0 session.commit()
def log_in(username): user = UserController.get_by_username(username) user.is_active = 1 session.commit()
def create(username, password): user = User(username=username, password=password) session.add(user) session.commit()
def add_reservations(): session.add_all([Reservation(user_id=1, projection_id=2, row=2, column=3), Reservation(user_id=1, projection_id=2, row=2, column=4)]) session.commit()
def add_users(): session.add_all([User(username="******", password="******", is_active=0), User(username="******", password="******", is_active=0) ]) session.commit()