Class UserMutationController
java.lang.Object
it.univr.passportease.controller.user.UserMutationController
Controller for all the user mutations. It handles the following GraphQL mutations:
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BucketLimiterBucket limiter.private final JwtServiceRequest analyzer.private RequestAnalyzerRequest analyzer.private final UserMutationServiceUser mutation service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateNotification(NotificationInput notificationInput) This mutation creates a notification.createReservation(String availabilityID) This mutation creates a reservation from an availability.voiddeleteNotification(UUID notificationId) This mutation deletes a notification.voiddeleteReservation(String availabilityID) This mutation deletes a reservation.modifyNotification(NotificationInput notificationInput, UUID notificationId) This mutation modifies a notification.voidpreserveAvailability(String availabilityID)
-
Field Details
-
userMutationService
User mutation service. -
jwtService
Request analyzer. -
bucketLimiter
Bucket limiter. -
requestAnalyzer
Request analyzer.
-
-
Constructor Details
-
UserMutationController
public UserMutationController()
-
-
Method Details
-
createReservation
@MutationMapping public Availability createReservation(@Argument("availabilityID") String availabilityID) throws RateLimitException, AvailabilityNotFoundException, UserNotFoundException, InvalidAvailabilityIDException This mutation creates a reservation from an availability. It returns the created reservation.- Parameters:
availabilityID- the availability ID to create the reservation from.- Returns:
- the created reservation
- Throws:
RateLimitException- if the user has exceeded the rate limitAvailabilityNotFoundException- if the availability is not foundUserNotFoundException- if the user is not foundInvalidAvailabilityIDException- if the availability 'ritiro passaporto' date is not valid, or if the availability is already taken. It must be at least one month after the last rilascio passaporto
-
deleteReservation
@MutationMapping public void deleteReservation(@Argument("availabilityID") String availabilityID) throws RateLimitException, AvailabilityNotFoundException This mutation deletes a reservation. It returns nothing.- Parameters:
availabilityID- the availability ID to delete.- Throws:
RateLimitException- if the user has exceeded the rate limitAvailabilityNotFoundException- if the availability is not found
-
createNotification
@MutationMapping public Notification createNotification(@Argument("notification") NotificationInput notificationInput) throws UserNotFoundException, InvalidWorkerActionException, AuthenticationCredentialsNotFoundException, RateLimitException, InvalidRequestTypeException, OfficeNotFoundException This mutation creates a notification. It returns the created notification.- Parameters:
notificationInput- seeNotificationInput, the notification to create- Returns:
- the created notification
- Throws:
UserNotFoundException- if the user is not foundInvalidWorkerActionException- if the user is a workerAuthenticationCredentialsNotFoundException- if the token is not in the requestRateLimitException- if the user has exceeded the rate limitInvalidRequestTypeException- if the request type is invalidOfficeNotFoundException- if the office is not found
-
modifyNotification
@MutationMapping public Notification modifyNotification(@Argument("notification") NotificationInput notificationInput, @Argument("notificationID") UUID notificationId) throws RateLimitException, NotificationNotFoundException, OfficeNotFoundException, RequestTypeNotFoundException This mutation modifies a notification. It returns the modified notification.- Parameters:
notificationInput- seeNotificationInput, the notification to modifynotificationId- the notification ID to modify- Returns:
- the modified notification
- Throws:
RateLimitException- if the user has exceeded the rate limitNotificationNotFoundException- if the notification is not foundOfficeNotFoundException- if the office is not foundRequestTypeNotFoundException- if the request type is not found
-
deleteNotification
@MutationMapping public void deleteNotification(@Argument("notificationID") UUID notificationId) throws RateLimitException This mutation deletes a notification. It returns nothing.- Parameters:
notificationId- the notification ID to delete- Throws:
RateLimitException- if the user has exceeded the rate limit
-
preserveAvailability
@MutationMapping public void preserveAvailability(@Argument("availabilityID") String availabilityID) throws RateLimitException, AvailabilityNotFoundException
-