Skip to content

Commit

Permalink
feat(auth-api): Filter delegation indexing by provider (#16141)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
saevarma and kodiakhq[bot] authored Sep 24, 2024
1 parent e8e70b8 commit c7efccb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ import {
const TEN_MINUTES = 1000 * 60 * 10
const ONE_WEEK = 1000 * 60 * 60 * 24 * 7

// When delegation providers have been refactored to use the webhook method
// with hard check on action we need to exclude them from the standard indexing.
// We register our current providers as indexed, as all new providers are expected
// to use the webhook method.
const INDEXED_DELEGATION_PROVIDERS = [
AuthDelegationProvider.Custom,
AuthDelegationProvider.PersonalRepresentativeRegistry,
AuthDelegationProvider.CompanyRegistry,
AuthDelegationProvider.NationalRegistry,
]

export type DelegationIndexInfo = Pick<
DelegationIndex,
| 'toNationalId'
Expand Down Expand Up @@ -343,6 +354,7 @@ export class DelegationsIndexService {
const currRecords = await this.delegationIndexModel.findAll({
where: {
toNationalId: nationalId,
provider: INDEXED_DELEGATION_PROVIDERS,
},
})

Expand Down

0 comments on commit c7efccb

Please sign in to comment.