Klasse RecommendationService
java.lang.Object
com.spaghetticodegang.trylater.recommendation.RecommendationService
Service layer for handling business logic related to recommendations.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungcreateRecommendation
(User me, RecommendationRequestDto request) Creates a new recommendation and sent it to a list of contacts.createRecommendationResponseDto
(Recommendation recommendation) Creates a response DTO from aRecommendation
entity.void
deleteRecommendationAssignment
(User me, Long recommendationId) Deletes a recommendation assignment from given user and recommendation ID.getAllRecommendationsByUserAndRecommendationStatus
(User me, RecommendationAssignmentStatus recommendationAssignmentStatus) Lists all assigned recommendation with a specific status for a given user.updateRecommendationAssignmentStatus
(User me, Long recommendationId, RecommendationAssignmentStatusRequestDto request) Updates the status of aRecommendationAssignment
for the currently authenticated user.
-
Konstruktordetails
-
RecommendationService
public RecommendationService()
-
-
Methodendetails
-
createRecommendation
Creates a new recommendation and sent it to a list of contacts. Performs validation to prevent invalid categories.- Parameter:
me
- the authenticated userrequest
- the recommendation request containing the receiver IDs- Gibt zurück:
- a response DTO representing the newly created recommendation
- Löst aus:
ValidationException
- if the category is not found
-
createRecommendationResponseDto
Creates a response DTO from aRecommendation
entity.- Parameter:
recommendation
- the recommendation entity- Gibt zurück:
- a response DTO representing the recommendation
-
updateRecommendationAssignmentStatus
public RecommendationResponseDto updateRecommendationAssignmentStatus(User me, Long recommendationId, RecommendationAssignmentStatusRequestDto request) Updates the status of aRecommendationAssignment
for the currently authenticated user.- Parameter:
me
- the currently authenticatedUser
recommendationId
- the ID of theRecommendation
to update the assignment statusrequest
- theRecommendationAssignmentStatusRequestDto
containing the new status- Gibt zurück:
- a response DTO representing the recommendation
- Löst aus:
RecommendationNotFoundException
- if there is no recommendation with requested ID
-
getAllRecommendationsByUserAndRecommendationStatus
public List<RecommendationResponseDto> getAllRecommendationsByUserAndRecommendationStatus(User me, RecommendationAssignmentStatus recommendationAssignmentStatus) Lists all assigned recommendation with a specific status for a given user.- Parameter:
me
- the currently authenticated userrecommendationAssignmentStatus
- status of the assigment- Gibt zurück:
- a list of response DTOs representing the recommendations
-
deleteRecommendationAssignment
Deletes a recommendation assignment from given user and recommendation ID. Deletes a recommendation at all if there is no recommendation assignment for that recommendation.- Parameter:
me
- the user that assignment should be deletedrecommendationId
- the recommendation ID that assignment should be deleted
-