Class UserQueryServiceImpl
java.lang.Object
it.univr.passportease.service.user.impl.UserQueryServiceImpl
- All Implemented Interfaces:
UserQueryService
Implementation of
UserQueryService.
It provides an implementation for the GraphQL queries that can be executed by the user.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JwtServiceThe service that handles the JWT.private final NotificationRepositoryThe repository forNotificationentity.private final RequestTypeRepositoryThe repository forRequestTypeentity.private final ReservationRepositoryThe repository forAvailabilityentity.private final UserRepositoryThe repository forUserentity. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetReportDetailsByAvailabilityID(String availabilityId, JWT token) Get the report details of the availability with the given UUID.getRequestTypesByUser(JWT token) Get the list of request types that the user can make.getUserDetails(JWT token) Get the user details from the JWT token.getUserNotifications(JWT token) Get the list of notifications of the user.getUserReservations(JWT token) Get the list of reservations of the user.
-
Field Details
-
userRepository
The repository forUserentity. -
notificationRepository
The repository forNotificationentity. -
reservationRepository
The repository forAvailabilityentity. -
requestTypeRepository
The repository forRequestTypeentity. -
jwtService
The service that handles the JWT.
-
-
Constructor Details
-
UserQueryServiceImpl
public UserQueryServiceImpl()
-
-
Method Details
-
getUserDetails
@PreAuthorize("hasAuthority(\'USER\') && hasAuthority(\'VALIDATED\')") public User getUserDetails(JWT token) throws UserNotFoundException Get the user details from the JWT token.- Specified by:
getUserDetailsin interfaceUserQueryService- Parameters:
token- JWT token- Returns:
- User details
- Throws:
UserNotFoundException- if the user is not found
-
getUserNotifications
@PreAuthorize("hasAuthority(\'USER\') && hasAuthority(\'VALIDATED\')") public List<Notification> getUserNotifications(JWT token) Get the list of notifications of the user.- Specified by:
getUserNotificationsin interfaceUserQueryService- Parameters:
token- JWT token- Returns:
- List of notifications
-
getUserReservations
@PreAuthorize("hasAuthority(\'USER\') && hasAuthority(\'VALIDATED\')") public List<Availability> getUserReservations(JWT token) Get the list of reservations of the user.- Specified by:
getUserReservationsin interfaceUserQueryService- Parameters:
token- JWT token- Returns:
- List of reservations of the user
-
getReportDetailsByAvailabilityID
@PreAuthorize("hasAuthority(\'USER\') && hasAuthority(\'VALIDATED\')") public ReportDetails getReportDetailsByAvailabilityID(String availabilityId, JWT token) throws SecurityException, InvalidAvailabilityIDException Get the report details of the availability with the given UUID.- Specified by:
getReportDetailsByAvailabilityIDin interfaceUserQueryService- Parameters:
availabilityId- UUID of the availabilitytoken- JWT token- Returns:
- Report details of the availability with the given UUID
- Throws:
SecurityException- if the user is not the owner of the availability, or if the token is from a workerInvalidAvailabilityIDException- if the availability is not found
-
getRequestTypesByUser
@PreAuthorize("hasAuthority(\'USER\') && hasAuthority(\'VALIDATED\')") public List<RequestType> getRequestTypesByUser(JWT token) throws InvalidRequestTypeException Get the list of request types that the user can make. If the user has already made a request for the "digitalizzazione passaporto" or "creazione passaporto", then all the other request types are returned. Otherwise, only "digitalizzazione passaporto" and "creazione passaporto" are returned.- Specified by:
getRequestTypesByUserin interfaceUserQueryService- Parameters:
token- JWT token- Returns:
- List of request types that the user can make
- Throws:
InvalidRequestTypeException- if the request type is not found
-