Beispiel #1
0
def handle_500(err):
    return get_fail_response(500, err.description)
Beispiel #2
0
def handle_auth_error(error):
    return get_fail_response(403, error.error.get("description"))
Beispiel #3
0
def handle_404(err):
    return get_fail_response(404, err.description)
Beispiel #4
0
def get_artist(artist_id):
    artist = Artist.query.get(artist_id)
    return get_success_response(artist.format()) if artist else\
        get_fail_response(404, f"artist with id: {artist_id} not found")
Beispiel #5
0
def get_artists_names_list():
    artists = [{'id': artist.id, 'name': artist.name}
               for artist in Artist.query.order_by(Artist.name).all()]
    return get_success_response(artists) if artists else\
        get_fail_response(404, 'no data found')
Beispiel #6
0
def get_all():
    artists = [artist.format()
               for artist in Artist.query.order_by(Artist.name).all()]
    return get_success_response(artists) if artists else\
        get_fail_response(404, 'no data found')
Beispiel #7
0
def get_roles_list():
    roles = [role.format() for role in Role.query.all()]
    return get_success_response(roles) if roles else get_fail_response("no roles found")