merge code feature/Backend-DSC-MFA this branch date 15-05-2026
This commit is contained in:
+17
@@ -43,4 +43,21 @@ public interface ClientNomineeRepository extends JpaRepository<ClientNominee, Lo
|
||||
|
||||
@Query("SELECT COUNT(n) FROM ClientNominee n WHERE n.accountNo = :accountNo AND n.accountType = :accountType AND n.isDeleted = false")
|
||||
long countByAccountNoAndAccountType(@Param("accountNo") String accountNo, @Param("accountType") String accountType);
|
||||
|
||||
/**
|
||||
* Counts non-deleted nominee rows that link {@code nomineeClientId} as a nominee under
|
||||
* {@code clientId} for the given {@code accountType}. Backs the rule that the same person
|
||||
* may not be linked as a nominee more than once per (account owner, account type).
|
||||
* {@code excludeNomineeId} is set on update so a row doesn't conflict with itself.
|
||||
*/
|
||||
@Query("SELECT COUNT(n) FROM ClientNominee n "
|
||||
+ "WHERE n.client.id = :clientId "
|
||||
+ "AND n.nomineeClient.id = :nomineeClientId "
|
||||
+ "AND n.accountType = :accountType "
|
||||
+ "AND n.isDeleted = false "
|
||||
+ "AND (:excludeNomineeId IS NULL OR n.id <> :excludeNomineeId)")
|
||||
long countActiveByClientNomineeAndAccountType(@Param("clientId") Long clientId,
|
||||
@Param("nomineeClientId") Long nomineeClientId,
|
||||
@Param("accountType") String accountType,
|
||||
@Param("excludeNomineeId") Long excludeNomineeId);
|
||||
}
|
||||
|
||||
+6
-1
@@ -23,5 +23,10 @@ import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface SearchingClientRepository {
|
||||
|
||||
Page<SearchedClient> searchByText(String searchText, Pageable pageable, String officeHierarchy, boolean activeOnly);
|
||||
/**
|
||||
* @param legalFormValue null = no filter; 1 = Individual only; 2 = Non-Individual only.
|
||||
* Driven by the legal-form enum on Client (LegalForm.PERSON / .ENTITY).
|
||||
*/
|
||||
Page<SearchedClient> searchByText(String searchText, Pageable pageable, String officeHierarchy, boolean activeOnly,
|
||||
Integer legalFormValue);
|
||||
}
|
||||
|
||||
+9
-1
@@ -52,7 +52,8 @@ public class SearchingClientRepositoryImpl implements SearchingClientRepository
|
||||
private final CriteriaQueryFactory criteriaQueryFactory;
|
||||
|
||||
@Override
|
||||
public Page<SearchedClient> searchByText(String searchText, Pageable pageable, String officeHierarchy, boolean activeOnly) {
|
||||
public Page<SearchedClient> searchByText(String searchText, Pageable pageable, String officeHierarchy, boolean activeOnly,
|
||||
Integer legalFormValue) {
|
||||
/*
|
||||
* this whole thing can be replaced with Spring Data JPA 3+ with a findBy(Specification, Pageable) call but at
|
||||
* this point the upgrade is too costly
|
||||
@@ -85,6 +86,13 @@ public class SearchingClientRepositoryImpl implements SearchingClientRepository
|
||||
predicates.add(cb.equal(r.get("status"), ClientStatus.ACTIVE.getValue()));
|
||||
}
|
||||
|
||||
// Restrict to one legal form when requested. Used by guardian/nominee/family-member
|
||||
// pickers so non-individual entities (companies, partnerships) never appear as
|
||||
// selectable parties — they can never legally hold those relationships.
|
||||
if (legalFormValue != null) {
|
||||
predicates.add(cb.equal(r.get("legalForm"), legalFormValue));
|
||||
}
|
||||
|
||||
return cb.and(predicates.toArray(new Predicate[0]));
|
||||
};
|
||||
criteriaQueryFactory.applySpecificationToCriteria(root, spec, query);
|
||||
|
||||
+2
-1
@@ -22,7 +22,8 @@ public enum MfaFactorType {
|
||||
SMS,
|
||||
EMAIL,
|
||||
TOTP,
|
||||
TOKEN;
|
||||
TOKEN,
|
||||
DSC;
|
||||
|
||||
public static MfaFactorType fromString(final String s) {
|
||||
if (s == null) {
|
||||
|
||||
Reference in New Issue
Block a user