Esempio n. 1
0
def get_flow(db: Session, flow_id: int, flow_runs=10):
    flow = db.query(Flow).get(flow_id)
    flow_runs = (db.query(FlowRun).filter_by(flow=flow).order_by(
        FlowRun.id.desc()).limit(flow_runs).all())
    flow.flow_runs = sorted(flow_runs, key=lambda x: x.id)
    return flow
Esempio n. 2
0
def delete_flow(db: Session, flow_id: int):
    flow = db.query(Flow).get(flow_id)
    if not flow.is_online:
        db.delete(flow)
        db.commit()
    return get_flows(db)
Esempio n. 3
0
def get_flows(db: Session, offset: int = 0, limit: int = 10):
    return db.query(Flow).offset(offset).limit(limit).all()