addMovieListToProfile method

Future<bool> addMovieListToProfile(
  1. String movieListId
)

Adds a movie list ID to the user profile.

Implementation

Future<bool> addMovieListToProfile(String movieListId) async {
  try {
    final profile = await getUserProfile();
    if (profile == null) return false;

    final movieListIds = List<String>.from(profile['movieListIds'] ?? []);
    if (!movieListIds.contains(movieListId)) {
      movieListIds.add(movieListId);

      return await createOrUpdateUserProfile(
        apiKey: profile['apiKey'],
        dobString: profile['dob'],
        genderString: profile['gender'],
        movieListIds: movieListIds,
      );
    }

    return true;
  } catch (e) {
    debugPrint('❌ Failed to add movie list to profile: $e');
    return false;
  }
}