コード例 #1
0
def delete_exam(examId):
    session = Session()
    exam = session.query(Exam).filter_by(id=examId).first()
    session.delete(exam)
    session.commit()
    session.close()
    return '', 201
コード例 #2
0
def delete_user(id):
    session = Session()
    user = session.query(User).filter(User.id == id).first()
    session.delete(user)
    session.commit()
    session.close()
    return "", 200
コード例 #3
0
def delete_offer(id):
    session = Session()
    offer = session.query(Offer).filter(Offer.id == id).first()
    session.delete(offer)
    session.commit()
    session.close()
    return "", 200
コード例 #4
0
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