Exemplo n.º 1
0
def get_follow(**options):
    db = DB()
    user_id, status, error = db.auth(options['username'], options['password'])
    if status:
        return response_error(status, error)

    data, status, error = db.get_follow_info(options['follow_id'])
    if status:
        return response_error(status, error)

    return response_ok({'follow_info': data})
Exemplo n.º 2
0
def remove_follow(**options):
    db = DB()
    user_id, status, error = db.auth(options['username'], options['password'])
    if status:
        return response_error(status, error)

    data, status, error = db.get_follow_info(options['follow_id'])
    if status:
        return response_error(status, error)

    if data['user_id'] != user_id:
        return response_error(1, 'you cant remove others follows')

    status, error = db.remove_follow(options['follow_id'])
    if status:
        return response_error(status, error)

    return response_ok()