fixed error nominee add error

This commit is contained in:
Nitesh Yadav
2026-05-15 16:09:13 +05:30
parent 001a79e35e
commit 4eeee03f24
3 changed files with 12335 additions and 11 deletions
@@ -287,8 +287,11 @@ public class ClientNomineeWritePlatformServiceImpl implements ClientNomineeWrite
if (clientId == null || nomineeClientId == null || accountType == null || accountType.isBlank()) {
return;
}
final long existing = nomineeRepository.countActiveByClientNomineeAndAccountType(
clientId, nomineeClientId, accountType, excludeNomineeId);
final long existing = (excludeNomineeId != null)
? nomineeRepository.countActiveByClientNomineeAndAccountTypeExcluding(
clientId, nomineeClientId, accountType, excludeNomineeId)
: nomineeRepository.countActiveByClientNomineeAndAccountType(
clientId, nomineeClientId, accountType);
if (existing > 0) {
throw new PlatformDataIntegrityException("error.msg.nominee.already.linked.for.account.type",
"This person is already a nominee for one of the client's "