account-service CLS-533 разрешение редактировать все счета (потому что только статус меняется)

This commit is contained in:
AKurakin 2023-09-14 12:52:24 +03:00
parent 9dc45f2165
commit eccfb27efe
2 changed files with 10 additions and 4 deletions

View file

@ -141,10 +141,12 @@ public class AccountValidationConfig {
AccountTypeDictionary.class, AccountTypeDictionary.class,
AccountError.RequiredFieldEmpty, AccountError.RequiredFieldEmpty,
AccountError.WrongFieldValue, AccountError.WrongFieldValue,
accountType -> { false
if (AccountType.Corr.equalsByKey(accountType.getCode())) return null; // accountType -> {
return AccountError.WrongFieldValue; // if (AccountType.Corr.equalsByKey(accountType.getCode())) return null;
}) // return AccountError.WrongFieldValue;
// }
)
); );
}; };
} }

View file

@ -163,6 +163,10 @@ public class AccountService extends QueueConsumer implements InitializingBean {
CorrespondentAccountUpdateRequest request = userRequest.getRequestPayload(); CorrespondentAccountUpdateRequest request = userRequest.getRequestPayload();
Account account = accountMap.getSingleObjectByID(request.getId()); Account account = accountMap.getSingleObjectByID(request.getId());
if (request.getAccountType() != null && !request.getAccountType().equals(account.getAccountType())) {
requestInfoUpdate = makeError(userRequest.getId(), AccountError.WrongFieldValue, "accountType");
return requestInfoUpdate;
}
if (request.getStatus() != null) account.setStatus(request.getStatus()); if (request.getStatus() != null) account.setStatus(request.getStatus());