Class UserMediaListServiceImpl
java.lang.Object
com.espacogeek.geek.services.impl.UserMediaListServiceImpl
- All Implemented Interfaces:
UserMediaListService
An implementation class of UserMediaListService @see UserMediaListService
-
Constructor Summary
ConstructorsConstructorDescriptionUserMediaListServiceImpl(UserMediaListRepository userMediaListRepository, UserRepository userRepository, MediaRepository mediaRepository, UserCustomStatusRepository userCustomStatusRepository) -
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).
-
Constructor Details
-
UserMediaListServiceImpl
public UserMediaListServiceImpl(UserMediaListRepository userMediaListRepository, UserRepository userRepository, MediaRepository mediaRepository, UserCustomStatusRepository userCustomStatusRepository)
-
-
Method Details
-
findByUserIdWithFilters
public List<UserMediaListModel> findByUserIdWithFilters(Integer userId, String status, Integer statusId, Integer categoryId, CategoryType categoryName, Integer genreId, String genreName, Integer mediaId, String mediaName, String altTitle) Description copied from interface:UserMediaListServiceRetrieves all library entries for the given user, with optional filters.- Specified by:
findByUserIdWithFiltersin interfaceUserMediaListService- 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 - See Also:
-
addMedia
Description copied from interface:UserMediaListServiceAdds a media item to the user's library with default status (StatusType.PLANNING) and progress 0. ThrowsMediaAlreadyInLibraryExceptionif the entry already exists.- Specified by:
addMediain interfaceUserMediaListService- Parameters:
userId- the ID of the authenticated usermediaId- the ID of the media to add- Returns:
- the newly created
UserMediaListModelentry - See Also:
-
upsertUserMedia
@Transactional public UserMediaListModel upsertUserMedia(Integer userId, UpdateUserMediaInput input) Description copied from interface:UserMediaListServiceCreates 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.- Specified by:
upsertUserMediain interfaceUserMediaListService- Parameters:
userId- the ID of the authenticated userinput- the input data for the create-or-update operation- Returns:
- the persisted (created or updated)
UserMediaListModelentry - See Also:
-
removeMedia
Description copied from interface:UserMediaListServiceRemoves a media item from the user's library.- Specified by:
removeMediain interfaceUserMediaListService- Parameters:
userId- the ID of the authenticated usermediaId- the ID of the media to remove- Returns:
trueif the entry was found and deleted,falseotherwise- See Also:
-