def get_movies(_):
    from backend.models import Movie
    movies = Movie.get_all()
    return jsonify({
        'success': True,
        'data': [to_dict(movie) for movie in movies]
    })
def fetch_movies_cast(_):
    from backend.models import Movie
    movies = Movie.get_all()
    if movies is None or len(movies) == 0:
        return jsonify({'success': False, 'msg': f'No movies found!!!!'})
    res_data = []
    for movie in movies:
        res_data.append({
            'movie': to_dict(movie),
            'actors': [to_dict(actor) for actor in movie.actors]
        })
    return jsonify({'success': True, 'data': res_data})