Skip to content

Commit

Permalink
Merge branch 'main' into fix/fix-rule-builder-being-broken-by-sanctio…
Browse files Browse the repository at this point in the history
…n-trigger-optional
  • Loading branch information
ChibiBlasphem authored Mar 5, 2025
2 parents 596440c + bc42fc4 commit a98f480
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 145 deletions.
3 changes: 2 additions & 1 deletion packages/app-builder/src/locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@
"no_name": "لا اسم",
"select_all": "حدد كل شيء",
"missing_configuration": "حدد الرخام التكوين المفقود لهذه الميزة. \nيرجى التحقق من المستندات لإعداد التكوين الصحيح.",
"missing_configuration_title": "التكوين المفقود"
"missing_configuration_title": "التكوين المفقود",
"dataset_freshness_banner": "البيانات المستخدمة لفحص العقوبات الخاص بك ليست محدثة (لم يتم سحب الإصدار الأخير في {{lallexport}} بعد). <br /> استشر فريق النظام الأساسي إذا لم تحل المشكلات نفسها قريبًا."
}
1 change: 1 addition & 0 deletions packages/app-builder/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"search": "Search",
"missing_configuration_title": "Missing Configuration",
"missing_configuration": "Marble identified missing configuration for this feature. Please check the docs for the correct configuration setup.",
"dataset_freshness_banner": "The data used for your sanction screening is not up to date (last version published at {{ lastExport }} has not been pulled yet).<br />Consult your platform team if the issues does not resolve itself soon.",
"error_one": "{{count}} error",
"error_other": "{{count}} errors",
"validation_error_one": "{{count}} validation error",
Expand Down
3 changes: 2 additions & 1 deletion packages/app-builder/src/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@
"no_name": "Pas de nom",
"select_all": "Sélectionnez tout",
"missing_configuration": "Marble a identifié une mauvaise configuration pour cette fonctionnalité. \nVeuillez vérifier la documentation pour la bonne configuration.",
"missing_configuration_title": "Configuration manquante"
"missing_configuration_title": "Configuration manquante",
"dataset_freshness_banner": "Les données utilisées pour votre dépistage de sanction ne sont pas à jour (la dernière version publiée le {{ lastExport }} n'a pas encore été récupérée). <br />Consultez votre équipe de plate-forme si les problèmes persistent."
}
28 changes: 27 additions & 1 deletion packages/app-builder/src/models/sanction-check-dataset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type OpenSanctionsCatalogDto } from 'marble-api';
import { type OpenSanctionsCatalogDto, type OpenSanctionsDatasetFreshnessDto } from 'marble-api';

export type OpenSanctionsCatalogDataset = {
name: string;
Expand Down Expand Up @@ -27,3 +27,29 @@ export function adaptOpenSanctionsCatalog(catalog: OpenSanctionsCatalogDto): Ope
})),
};
}

export type OpenSanctionsUpstreamDatasetFreshness = {
version: string;
name: string;
lastExport: string;
};

export type OpenSanctionsDatasetFreshness = {
upstream: OpenSanctionsUpstreamDatasetFreshness;
version: string;
upToDate: boolean;
};

export function adaptOpenSanctionsDatasetFreshness(
datasetFreshness: OpenSanctionsDatasetFreshnessDto,
): OpenSanctionsDatasetFreshness {
return {
upstream: {
version: datasetFreshness.upstream.version,
name: datasetFreshness.upstream.name,
lastExport: datasetFreshness.upstream.last_export,
},
version: datasetFreshness.version,
upToDate: datasetFreshness.up_to_date,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ import {
} from '@app-builder/models/sanction-check';
import {
adaptOpenSanctionsCatalog,
adaptOpenSanctionsDatasetFreshness,
type OpenSanctionsCatalog,
type OpenSanctionsDatasetFreshness,
} from '@app-builder/models/sanction-check-dataset';
import * as R from 'remeda';

export interface SanctionCheckRepository {
listSanctionChecks(args: { decisionId: string }): Promise<SanctionCheck[]>;
listDatasets(): Promise<OpenSanctionsCatalog>;
getDatasetFreshness(): Promise<OpenSanctionsDatasetFreshness>;
updateMatchStatus(args: {
matchId: string;
status: Extract<SanctionCheckMatchStatus, 'no_hit' | 'confirmed_hit'>;
Expand All @@ -44,6 +47,9 @@ export function makeGetSanctionCheckRepository() {
listDatasets: async () => {
return adaptOpenSanctionsCatalog(await marbleCoreApiClient.listOpenSanctionDatasets());
},
getDatasetFreshness: async () => {
return adaptOpenSanctionsDatasetFreshness(await marbleCoreApiClient.getDatasetsFreshness());
},
listSanctionChecks: async ({ decisionId }) => {
return R.map(await marbleCoreApiClient.listSanctionChecks(decisionId), adaptSanctionCheck);
},
Expand Down
Loading

0 comments on commit a98f480

Please sign in to comment.