def delete_exam(examId): session = Session() exam = session.query(Exam).filter_by(id=examId).first() session.delete(exam) session.commit() session.close() return '', 201
def delete_user(id): session = Session() user = session.query(User).filter(User.id == id).first() session.delete(user) session.commit() session.close() return "", 200
def delete_offer(id): session = Session() offer = session.query(Offer).filter(Offer.id == id).first() session.delete(offer) session.commit() session.close() return "", 200
def deleteOldPasswordChangeId(): try: expireTime = datetime.datetime.now() - datetime.timedelta(minutes=10) session = Session() expiredIds = session.query(IdCambioContrasenna).filter( IdCambioContrasenna.fechaCreacion < expireTime).all() for id in expiredIds: session.delete(id) session.commit() return '', 200 except: return '', 400