Class ClientRestController

java.lang.Object
es.kukenan.smartfi.microservice.backoffice.controller.ClientRestController

@RestController public class ClientRestController extends Object
Clients Rest API controller.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Authority (role) required in order to be able to invoke greeting API.
    static final String
    Authority (role) required in order to be able to invoke change application status.
    static final String
    Base path for backoffice Rest API.
    static final String
    Authority (role) required in order to be able to invoke company endpoints.
    static final String
    Count clients and users (Promotor/Empresa).
    static final String
    Create backoffice User path.
    static final String
    Search client by document.
    static final String
    Search detail client.
    static final String
    Search clients.
    static final String
    Search detail user (Promotor/Empresa).
    static final String
    Search users (Promotor/Empresa).
    private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl
    JWT service for create a bearer to call products.
    static final String
    Search roles.
    private UserService
    Users service.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Map<String,Long>>>
    countClientsUsers(es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Count clients and users (promotor/empresa).
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackofficeResponse>>>
    createUser(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CreateCompanyBackofficeRequestDto createUserBackofficeRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Create backoffice consultant or company user.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>
    findClient(String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find detail User.
    org.springframework.http.ResponseEntity<Object>
    findClientByDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, es.kukenan.smartfi.dto.backoffice.UserBackofficeRequestDTO userBackofficeRequest)
    Find if user exist by Document Id.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>>
    findClients(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find User by Document id endpoint.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>
    findUser(String userId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find detail User.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>>
    findUsers(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, Integer pageNumber, Integer pageSize, String sortedBy, String type, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Find User by Document id endpoint.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.requestedfiles.DataObject>>>
    Find available roles for create users.
    org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>>
    updateClient(es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.UpdateUserDto updateUserDto, String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
    Update some client data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • API_BASE_PATH

      public static final String API_BASE_PATH
      Base path for backoffice Rest API.
      See Also:
    • ROLES_PATH

      public static final String ROLES_PATH
      Search roles.
      See Also:
    • FIND_CLIENTS_PATH

      public static final String FIND_CLIENTS_PATH
      Search clients.
      See Also:
    • FIND_CLIENT_BY_DOCUMENT_PATH

      public static final String FIND_CLIENT_BY_DOCUMENT_PATH
      Search client by document.
      See Also:
    • FIND_CLIENT_DETAIL_PATH

      public static final String FIND_CLIENT_DETAIL_PATH
      Search detail client.
      See Also:
    • FIND_USERS_PATH

      public static final String FIND_USERS_PATH
      Search users (Promotor/Empresa).
      See Also:
    • COUNT_CLIENTS_USERS_PATH

      public static final String COUNT_CLIENTS_USERS_PATH
      Count clients and users (Promotor/Empresa).
      See Also:
    • FIND_USER_DETAIL_PATH

      public static final String FIND_USER_DETAIL_PATH
      Search detail user (Promotor/Empresa).
      See Also:
    • CREATE_USER_PATH

      public static final String CREATE_USER_PATH
      Create backoffice User path.
      See Also:
    • jwtService

      @Autowired private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl jwtService
      JWT service for create a bearer to call products.
    • userService

      @Autowired private UserService userService
      Users service.
    • API_AUTHORITIES

      public static final String API_AUTHORITIES
      Authority (role) required in order to be able to invoke greeting API.
      See Also:
    • API_BACKOFFICE_AUTHORITIES

      public static final String API_BACKOFFICE_AUTHORITIES
      Authority (role) required in order to be able to invoke change application status.
      See Also:
    • API_COMPANY_AUTHORITIES

      public static final String API_COMPANY_AUTHORITIES
      Authority (role) required in order to be able to invoke company endpoints.
      See Also:
  • Constructor Details

    • ClientRestController

      public ClientRestController()
  • Method Details

    • getRoles

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @GetMapping(path="/api/v1/backoffice/roles", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.requestedfiles.DataObject>>> getRoles()
      Find available roles for create users.
      Returns:
      roles list.
    • findClients

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @PostMapping(path="/api/v1/backoffice/clients", produces="application/json", consumes="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>> findClients(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, @RequestParam(name="pageNumber",required=false) Integer pageNumber, @RequestParam(name="pageSize",required=false) Integer pageSize, @RequestParam(name="sortedBy",required=false) String sortedBy, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find User by Document id endpoint.
      Parameters:
      filterUserRequestDto - fields to filter
      pageNumber - the page to search
      pageSize - max number of rows per page
      sortedBy - field to sort
      authentication - user credentials.
      Returns:
      user list.
    • findUsers

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PostMapping(path="/api/v1/backoffice/users", produces="application/json", consumes="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto>>> findUsers(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.FilterUserRequestDto filterUserRequestDto, @RequestParam(name="pageNumber",required=false) Integer pageNumber, @RequestParam(name="pageSize",required=false) Integer pageSize, @RequestParam(name="sortedBy",required=false) String sortedBy, @RequestParam(name="type",required=false) String type, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find User by Document id endpoint.
      Parameters:
      filterUserRequestDto - fields to filter
      pageNumber - the page to search
      pageSize - max number of rows per page
      sortedBy - field to sort
      type - Type of user to search
      authentication - user credentials.
      Returns:
      user list.
    • findClient

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @GetMapping(path="/api/v1/backoffice/client/{clientId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> findClient(@PathVariable("clientId") String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find detail User.
      Parameters:
      clientId - client identifier
      authentication - user credentials.
      Returns:
      user detail.
    • findUser

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @GetMapping(path="/api/v1/backoffice/user/{userId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> findUser(@PathVariable("userId") String userId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Find detail User.
      Parameters:
      userId - client identifier
      authentication - user credentials.
      Returns:
      user detail.
    • createUser

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PostMapping(path="/api/v1/backoffice/new-user", produces="application/json", consumes="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CompanyUserBackofficeResponse>>> createUser(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.CreateCompanyBackofficeRequestDto createUserBackofficeRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Create backoffice consultant or company user.
      Parameters:
      createUserBackofficeRequestDto - new user information.
      authentication - user credentials.
      Returns:
      user list.
    • countClientsUsers

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @GetMapping(path="/api/v1/backoffice/clients-users", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Map<String,Long>>> countClientsUsers(es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Count clients and users (promotor/empresa).
      Parameters:
      authentication - user credentials.
      Returns:
      user list.
    • findClientByDocument

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_CONSULTANT\') and hasRole(\'ROLE_LEVEL_USER_CONSULTANT\'))") @PostMapping(path="/api/v1/backoffice/client", produces="application/json", consumes="application/json") public org.springframework.http.ResponseEntity<Object> findClientByDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @RequestBody es.kukenan.smartfi.dto.backoffice.UserBackofficeRequestDTO userBackofficeRequest)
      Find if user exist by Document Id.
      Parameters:
      authentication - user credentials.
      userBackofficeRequest - filtered request fields
      Returns:
      User data
    • updateClient

      @PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @PutMapping(path="/api/v1/backoffice/client/{clientId}", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.DetailUserDto>> updateClient(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.UpdateUserDto updateUserDto, @PathVariable("clientId") String clientId, es.kukenan.smartfi.common.security.WalletAuthentication authentication)
      Update some client data.
      Parameters:
      updateUserDto - update information.
      clientId - client identifier
      authentication - user credentials.
      Returns:
      user detail.