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
Modifier and TypeFieldDescriptionprivate final JwtService
The service that handles the JWT.private final NotificationRepository
The repository forNotification
entity.private final RequestTypeRepository
The repository forRequestType
entity.private final ReservationRepository
The repository forAvailability
entity.private final UserRepository
The repository forUser
entity. -
Constructor Summary
-
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 forUser
entity. -
notificationRepository
The repository forNotification
entity. -
reservationRepository
The repository forAvailability
entity. -
requestTypeRepository
The repository forRequestType
entity. -
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:
getUserDetails
in 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:
getUserNotifications
in 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:
getUserReservations
in 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:
getReportDetailsByAvailabilityID
in 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:
getRequestTypesByUser
in interfaceUserQueryService
- Parameters:
token
- JWT token- Returns:
- List of request types that the user can make
- Throws:
InvalidRequestTypeException
- if the request type is not found
-