From b28f762a97086a246cae93f25237b0a15c982132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A6var=20M=C3=A1r=20Atlason?= <54210288+saevarma@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:55:36 +0000 Subject: [PATCH] feat(auth-api): Filter delegation indexing by provider (#16141) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/lib/delegations/delegations-index.service.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts b/libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts index fb382c183b49..f6af5c4b46a5 100644 --- a/libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts +++ b/libs/auth-api-lib/src/lib/delegations/delegations-index.service.ts @@ -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' @@ -343,6 +354,7 @@ export class DelegationsIndexService { const currRecords = await this.delegationIndexModel.findAll({ where: { toNationalId: nationalId, + provider: INDEXED_DELEGATION_PROVIDERS, }, })