def remove_string_from_db(id_slack, suggestion): session = SQLManager().get_session() suggestion = session.query(OfferedTraining).filter_by( id_slack=id_slack, suggestion=suggestion).first() if suggestion is not None: session.delete(suggestion) session.commit() session.close()
def remove_offered_training(id_slack, suggestion): session = SQLManager().get_session() response = session.query(OfferedTraining).filter_by( id_slack=id_slack, suggestion=suggestion).first() if response is not None: session.delete(response) session.commit() response = session.query(RequestedTraining).filter_by( id_slack=id_slack, suggestion=suggestion).first() if response is not None: session.delete(response) session.commit() session.close()
def insert_offered_trainings(id_slack, team, suggestion): session = SQLManager().get_session() msg = OfferedTraining(id_slack, team, suggestion) session.add(msg) session.commit() session.close()
def insert_user(id_slack, team): session = SQLManager().get_session() user = User(id_slack, team) session.add(user) session.commit() session.close()