Search in sources :

Example 11 with AccountDTO

use of com.nexblocks.authguard.api.dto.entities.AccountDTO in project AuthGuard by AuthGuard.

the class AccountsRoute method deleteAccount.

public void deleteAccount(final Context context) {
    final String accountId = context.pathParam("id");
    final Optional<AccountDTO> account = accountsService.delete(accountId).map(restMapper::toDTO);
    if (account.isPresent()) {
        context.status(200).json(account.get());
    } else {
        context.status(404).json(new Error(ErrorCode.ACCOUNT_DOES_NOT_EXIST.getCode(), "Account not found"));
    }
}
Also used : Error(com.nexblocks.authguard.api.dto.entities.Error) AccountDTO(com.nexblocks.authguard.api.dto.entities.AccountDTO)

Aggregations

AccountDTO (com.nexblocks.authguard.api.dto.entities.AccountDTO)11 Error (com.nexblocks.authguard.api.dto.entities.Error)8 Inject (com.google.inject.Inject)1 AuthGuardRoles (com.nexblocks.authguard.api.access.AuthGuardRoles)1 AccountLockDTO (com.nexblocks.authguard.api.dto.entities.AccountLockDTO)1 AppDTO (com.nexblocks.authguard.api.dto.entities.AppDTO)1 com.nexblocks.authguard.api.dto.requests (com.nexblocks.authguard.api.dto.requests)1 CreateAccountRequestDTO (com.nexblocks.authguard.api.dto.requests.CreateAccountRequestDTO)1 AccountsApi (com.nexblocks.authguard.api.routes.AccountsApi)1 ActorDomainVerifier (com.nexblocks.authguard.rest.access.ActorDomainVerifier)1 RestMapper (com.nexblocks.authguard.rest.mappers.RestMapper)1 BodyHandler (com.nexblocks.authguard.rest.util.BodyHandler)1 IdempotencyHeader (com.nexblocks.authguard.rest.util.IdempotencyHeader)1 AccountLocksService (com.nexblocks.authguard.service.AccountLocksService)1 AccountsService (com.nexblocks.authguard.service.AccountsService)1 ApplicationsService (com.nexblocks.authguard.service.ApplicationsService)1 CredentialsService (com.nexblocks.authguard.service.CredentialsService)1 IdempotencyException (com.nexblocks.authguard.service.exceptions.IdempotencyException)1 ErrorCode (com.nexblocks.authguard.service.exceptions.codes.ErrorCode)1 com.nexblocks.authguard.service.model (com.nexblocks.authguard.service.model)1