Beispiel #1
0
def get_all():
    """ Get all peers unfiltered """
    peers = PeerController.get_all()

    if not peers:
        return jsonify(error='No peers were found'), 500

    ser_peers = []
    for peer in peers:
        ser_peer = row2dict(peer)
        ser_peer['job'] = None
        if (peer.task):
            ser_peer['job'] = row2dict(peer.task.job)
        ser_peers.append(ser_peer)

    return jsonify(peers=ser_peers)
Beispiel #2
0
def get_all():
    """ Get all peers unfiltered """
    peers = PeerController.get_all()

    if not peers:
        return jsonify(error='No peers were found'), 500

    ser_peers = []
    for peer in peers:
        ser_peer = row2dict(peer)
        ser_peer['job'] = None
        if(peer.task):
            ser_peer['job'] = row2dict(peer.task.job)
        ser_peers.append(ser_peer)

    return jsonify(peers=ser_peers)
Beispiel #3
0
def get_all():
    users = User.query.all()
    return ([utils.row2dict(u) for u in users])
Beispiel #4
0
def get(id):
    u = User.query.get(id)
    return (utils.row2dict(u))
Beispiel #5
0
def get_all():
    posts = Post.query.all()
    return ([utils.row2dict(p) for p in posts])
Beispiel #6
0
def get(id):
    p = Post.query.get(id)
    return (utils.row2dict(p))