def handle_500(err): return get_fail_response(500, err.description)
def handle_auth_error(error): return get_fail_response(403, error.error.get("description"))
def handle_404(err): return get_fail_response(404, err.description)
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")
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')
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')
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")