Example #1
0
def del_client(session, client):
    c = Client.query.filter(Client.session_id == session, Client.id == client).first()

    db_session.delete(c)
    db_session.commit()

    return "", 200
Example #2
0
def del_video(session, video):
    v = Video.query.filter(Video.session_id == session, Video.id == video).first()

    db_session.delete(v);

    if v.client_id is not None and v.client.blocked is True:
        vcnt = Video.query.filter(Video.session_id == session,
                Video.client_id == v.client_id).count()
        if vcnt == 0:
            c = Client.query.filter(Client.id == v.client_id).first()
            c.blocked = False
            db_session.add(c)

    db_session.commit();

    return "", 200