Class ClientRestController
java.lang.Object
es.kukenan.smartfi.microservice.backoffice.controller.ClientRestController
Clients Rest API controller.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAuthority (role) required in order to be able to invoke greeting API.static final StringAuthority (role) required in order to be able to invoke change application status.static final StringBase path for backoffice Rest API.static final StringAuthority (role) required in order to be able to invoke company endpoints.static final StringCount clients and users (Promotor/Empresa).static final StringCreate backoffice User path.static final StringSearch client by document.static final StringSearch detail client.static final StringSearch clients.static final StringSearch detail user (Promotor/Empresa).static final StringSearch users (Promotor/Empresa).private es.kukenan.smartfi.common.service.jwt.JwtServiceImplJWT service for create a bearer to call products.static final StringSearch roles.private UserServiceUsers service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountClientsUsers(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>>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>>>getRoles()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.
-
Field Details
-
API_BASE_PATH
Base path for backoffice Rest API.- See Also:
-
ROLES_PATH
Search roles.- See Also:
-
FIND_CLIENTS_PATH
Search clients.- See Also:
-
FIND_CLIENT_BY_DOCUMENT_PATH
Search client by document.- See Also:
-
FIND_CLIENT_DETAIL_PATH
Search detail client.- See Also:
-
FIND_USERS_PATH
Search users (Promotor/Empresa).- See Also:
-
COUNT_CLIENTS_USERS_PATH
Count clients and users (Promotor/Empresa).- See Also:
-
FIND_USER_DETAIL_PATH
Search detail user (Promotor/Empresa).- See Also:
-
CREATE_USER_PATH
Create backoffice User path.- See Also:
-
jwtService
@Autowired private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl jwtServiceJWT service for create a bearer to call products. -
userService
Users service. -
API_AUTHORITIES
Authority (role) required in order to be able to invoke greeting API.- See Also:
-
API_BACKOFFICE_AUTHORITIES
Authority (role) required in order to be able to invoke change application status.- See Also:
-
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 filterpageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sortauthentication- 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 filterpageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sorttype- Type of user to searchauthentication- 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 identifierauthentication- 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 identifierauthentication- 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 identifierauthentication- user credentials.- Returns:
- user detail.
-