Interface UserMediaListService

All Known Implementing Classes:
UserMediaListServiceImpl

public interface UserMediaListService
Interface for the UserMediaListService, which provides methods for managing the user's personal media library.
  • Method Details

    • findByUserIdWithFilters

      List<UserMediaListModel> findByUserIdWithFilters(Integer userId, String status, Integer statusId, Integer categoryId, CategoryType categoryName, Integer genreId, String genreName, Integer mediaId, String mediaName, String altTitle)
      Retrieves all library entries for the given user, with optional filters.
      Parameters:
      userId - the ID of the authenticated user
      status - optional user tracking status string filter (e.g. "watching", "completed")
      statusId - optional media production status ID filter (MediaStatusModel.id)
      categoryId - optional media category ID filter
      categoryName - optional media category name filter (e.g. CategoryType.ANIME)
      genreId - optional genre ID filter
      genreName - optional genre name filter
      mediaId - optional media ID filter
      mediaName - optional media name filter (partial match)
      altTitle - optional alternative title filter (partial match)
      Returns:
      a list of matching UserMediaListModel entries
    • addMedia

      UserMediaListModel addMedia(Integer userId, Integer mediaId)
      Adds a media item to the user's library with default status (StatusType.PLANNING) and progress 0. Throws MediaAlreadyInLibraryException if the entry already exists.
      Parameters:
      userId - the ID of the authenticated user
      mediaId - the ID of the media to add
      Returns:
      the newly created UserMediaListModel entry
    • upsertUserMedia

      UserMediaListModel upsertUserMedia(Integer userId, UpdateUserMediaInput input)
      Creates or updates the user's library entry for the specified media (upsert). If an entry for the given user and input.mediaId already exists, it is updated with only the non-null fields from input. If no entry exists, a new one is created with the provided fields (status defaults to PLANNING when not specified).

      When the resulting status is PLANNING, datePlanned is set to the current timestamp automatically.

      Parameters:
      userId - the ID of the authenticated user
      input - the input data for the create-or-update operation
      Returns:
      the persisted (created or updated) UserMediaListModel entry
    • removeMedia

      boolean removeMedia(Integer userId, Integer mediaId)
      Removes a media item from the user's library.
      Parameters:
      userId - the ID of the authenticated user
      mediaId - the ID of the media to remove
      Returns:
      true if the entry was found and deleted, false otherwise