Interface CitizenSpecificRepository
- All Known Subinterfaces:
CitizenRepository
- All Known Implementing Classes:
CitizenSpecificRepositoryImpl
public interface CitizenSpecificRepository
Contract for custom MongoDB aggregation queries on CitizenConsent collection.
Defines complex queries that cannot be auto-generated by Spring Data MongoDB, such as nested field projections and dynamic consent filtering.
Implementation: CitizenSpecificRepositoryImpl
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<CitizenConsent> findByFiscalCodeAndTppId(String fiscalCode, String tppId) Finds a specific TPP consent within a citizen's document.reactor.core.publisher.Mono<CitizenConsent> findByFiscalCodeWithAtLeastOneConsent(String fiscalCode) Finds a citizen with at least one enabled consent across all TPPs.reactor.core.publisher.Flux<CitizenConsent> findByTppIdEnabled(String tppId) Finds all citizens with an enabled consent for a specific TPP.
-
Method Details
-
findByFiscalCodeAndTppId
reactor.core.publisher.Mono<CitizenConsent> findByFiscalCodeAndTppId(String fiscalCode, String tppId) Finds a specific TPP consent within a citizen's document.
Projects only the requested consent field (
consents.<tppId>) using MongoDB aggregation.- Parameters:
fiscalCode- citizen's fiscal code (must not benull)tppId- TPP identifier (must not benull)- Returns:
Monoemitting projected document with single consent, empty if not found or tppId isnull
-
findByTppIdEnabled
Finds all citizens with an enabled consent for a specific TPP.
Filters documents where
consents.<tppId>.tppState = trueand projects only fiscal code and the matching consent.- Parameters:
tppId- TPP identifier (must not benull)- Returns:
Fluxemitting projected documents with enabled consent (possibly empty)
-
findByFiscalCodeWithAtLeastOneConsent
reactor.core.publisher.Mono<CitizenConsent> findByFiscalCodeWithAtLeastOneConsent(String fiscalCode) Finds a citizen with at least one enabled consent across all TPPs.
Uses
$objectToArrayto flatten the consents map and filters fortppState = true.- Parameters:
fiscalCode- citizen's fiscal code (must not benull)- Returns:
Monoemitting the document if at least one consent is enabled, empty otherwise
-