Class UserMediaListController

java.lang.Object
com.espacogeek.geek.controllers.UserMediaListController

@Controller public class UserMediaListController extends Object
  • Constructor Details

    • UserMediaListController

      public UserMediaListController()
  • Method Details

    • findUserMediaLibrary

      @QueryMapping(name="findUserMediaLibrary") @PreAuthorize("hasRole(\'user\')") public List<UserMediaListModel> findUserMediaLibrary(@Argument(name="userId") Integer userId, @Argument(name="status") String status, @Argument(name="statusId") Integer statusId, @Argument(name="categoryId") Integer categoryId, @Argument(name="categoryName") String categoryName, @Argument(name="genreId") Integer genreId, @Argument(name="genreName") String genreName, @Argument(name="mediaId") Integer mediaId, @Argument(name="mediaName") String mediaName, @Argument(name="altTitle") String altTitle, org.springframework.security.core.Authentication authentication)
      Returns a user's media library, optionally filtered by status, statusId, category, categoryName, genre, genreId, mediaId, media name, or alternative title.

      If userId is omitted, returns the authenticated user's own library. If userId is provided and different from the authenticated user, only returns results if the target user's library is not marked as private.

      Parameters:
      userId - optional target user ID; defaults to the authenticated user
      status - optional user tracking status string filter (e.g. "IN_PROGRESS")
      statusId - optional media production status ID filter (MediaStatusModel.id)
      categoryId - optional media category ID filter
      categoryName - optional media category name filter (e.g. "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)
      authentication - the currently authenticated user (required)
      Returns:
      list of matching library entries belonging to the target user
    • addMediaToUserLibrary

      @MutationMapping(name="addMediaToUserLibrary") @PreAuthorize("hasRole(\'user\')") public UserMediaListModel addMediaToUserLibrary(@Argument(name="mediaId") Integer mediaId, org.springframework.security.core.Authentication authentication)
      Adds the specified media to the authenticated user's library with default status (PLANNING) and progress 0. Throws an error if the media is already in the user's library.
      Parameters:
      mediaId - the ID of the media to add
      authentication - the currently authenticated user
      Returns:
      the newly created library entry
    • upsertUserMedia

      @MutationMapping(name="upsertUserMedia") @PreAuthorize("hasRole(\'user\')") public UserMediaListModel upsertUserMedia(@Argument(name="input") UpdateUserMediaInput input, org.springframework.security.core.Authentication authentication)
      Creates or updates the authenticated user's library entry for the media specified in input.mediaId (upsert). Non-null fields in the input are applied to the entry; absent fields are left unchanged on update. When the resulting status is PLANNING, datePlanned is automatically set to the current timestamp.
      Parameters:
      input - the create-or-update payload
      authentication - the currently authenticated user
      Returns:
      the persisted (created or updated) library entry
    • removeMediaFromUserLibrary

      @MutationMapping(name="removeMediaFromUserLibrary") @PreAuthorize("hasRole(\'user\')") public Boolean removeMediaFromUserLibrary(@Argument(name="mediaId") Integer mediaId, org.springframework.security.core.Authentication authentication)
      Removes the specified media from the authenticated user's library.
      Parameters:
      mediaId - the ID of the media to remove
      authentication - the currently authenticated user
      Returns:
      true if the entry was removed, false if not found