Class UserQueryServiceImpl

java.lang.Object
it.univr.passportease.service.user.impl.UserQueryServiceImpl
All Implemented Interfaces:
UserQueryService

@Service public class UserQueryServiceImpl extends Object implements UserQueryService
Implementation of UserQueryService. It provides an implementation for the GraphQL queries that can be executed by the user.
  • Field Details

  • 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 interface UserQueryService
      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 interface UserQueryService
      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 interface UserQueryService
      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 interface UserQueryService
      Parameters:
      availabilityId - UUID of the availability
      token - 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 worker
      InvalidAvailabilityIDException - 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 interface UserQueryService
      Parameters:
      token - JWT token
      Returns:
      List of request types that the user can make
      Throws:
      InvalidRequestTypeException - if the request type is not found