(user_id=None)
Get all links that belong to user `user_id`
Get all links that belong to user `user_id`
Get all links that belong to user user_id
def get_links(user_id=None):
    """Get all links that belong to user `user_id`"""
    # TODO: get auth required from settings and get user links by id

    manager = LinkManager()
    schema = LinkSchema()
    if request.method == 'GET':
        user_email = APITokenAuth.get_jwt_identity()
        if not user_email:
            return jsonify(dict(error='Invalid/expired token passed')), 400
        user = UserManager().get_by_email(email=user_email)
        if not user:
            return jsonify(dict(error='Invalid/expired token passed')), 400
        links = manager.get_by_owner(owner_id=user.id)
        if not links:
            return jsonify([]), 200
        result = schema.dump(links, many=True)
        return jsonify(result.data)
def get_links ( user_id = None ) : # TODO: get auth required from settings and get user links by id manager = LinkManager ( ) schema = LinkSchema ( ) if request . method == 'GET' : user_email = APITokenAuth . get_jwt_identity ( ) if not user_email : return jsonify ( dict ( error = 'Invalid/expired token passed' ) ) , 400 user = UserManager ( ) . get_by_email ( email = user_email ) if not user : return jsonify ( dict ( error = 'Invalid/expired token passed' ) ) , 400 links = manager . get_by_owner ( owner_id = user . id ) if not links : return jsonify ( [ ] ) , 200 result = schema . dump ( links , many = True ) return jsonify ( result . data )