Package com.espacogeek.geek.services
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 Summary
Modifier and TypeMethodDescriptionAdds a media item to the user's library with default status (StatusType.PLANNING) and progress 0.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.booleanremoveMedia(Integer userId, Integer mediaId) Removes a media item from the user's library.upsertUserMedia(Integer userId, UpdateUserMediaInput input) Creates or updates the user's library entry for the specified media (upsert).
-
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 userstatus- optional user tracking status string filter (e.g. "watching", "completed")statusId- optional media production status ID filter (MediaStatusModel.id)categoryId- optional media category ID filtercategoryName- optional media category name filter (e.g.CategoryType.ANIME)genreId- optional genre ID filtergenreName- optional genre name filtermediaId- optional media ID filtermediaName- optional media name filter (partial match)altTitle- optional alternative title filter (partial match)- Returns:
- a list of matching
UserMediaListModelentries
-
addMedia
Adds a media item to the user's library with default status (StatusType.PLANNING) and progress 0. ThrowsMediaAlreadyInLibraryExceptionif the entry already exists.- Parameters:
userId- the ID of the authenticated usermediaId- the ID of the media to add- Returns:
- the newly created
UserMediaListModelentry
-
upsertUserMedia
Creates or updates the user's library entry for the specified media (upsert). If an entry for the given user andinput.mediaIdalready exists, it is updated with only the non-null fields frominput. If no entry exists, a new one is created with the provided fields (status defaults toPLANNINGwhen not specified).When the resulting status is
PLANNING,datePlannedis set to the current timestamp automatically.- Parameters:
userId- the ID of the authenticated userinput- the input data for the create-or-update operation- Returns:
- the persisted (created or updated)
UserMediaListModelentry
-
removeMedia
Removes a media item from the user's library.- Parameters:
userId- the ID of the authenticated usermediaId- the ID of the media to remove- Returns:
trueif the entry was found and deleted,falseotherwise
-