From ab1bb22781c31b4780831b2bdceb47b2bfd39e20 Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Tue, 14 Jan 2025 12:06:30 +0900 Subject: [PATCH] add deduplication config for tennis club membership --- package.json | 2 +- src/form/tennis-club-membership.ts | 19 ++++++++++++++++++- yarn.lock | 8 ++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 82124dad8..8cfa7e2b9 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/toolkit": "0.0.9-events", + "@opencrvs/toolkit": "0.0.13-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", "@types/fhir": "^0.0.30", diff --git a/src/form/tennis-club-membership.ts b/src/form/tennis-club-membership.ts index 4f187a246..a77269eb5 100644 --- a/src/form/tennis-club-membership.ts +++ b/src/form/tennis-club-membership.ts @@ -10,6 +10,7 @@ */ import { defineConfig, defineForm } from '@opencrvs/toolkit/events' + import { defineConditional, or, @@ -17,7 +18,8 @@ import { userHasScope, and, not, - field + field, + deduplication } from '@opencrvs/toolkit/conditionals' const TENNIS_CLUB_FORM = defineForm({ @@ -288,6 +290,21 @@ export const tennisClubMembershipEvent = defineConfig({ ] } ], + deduplication: [ + { + id: 'STANDARD CHECK', + label: { + defaultMessage: 'Standard check', + description: + 'This could be shown to the user in a reason for duplicate detected', + id: '...' + }, + query: deduplication.or([ + deduplication.field('requester.phone').strictMatches(), + deduplication.field('requester.name').fuzzyMatches() + ]) + } + ], actions: [ { type: 'DECLARE', diff --git a/yarn.lock b/yarn.lock index 777be188b..e558c8c1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,10 +790,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/toolkit@0.0.9-events": - version "0.0.9-events" - resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.9-events.tgz#a1d9d1d786f280171018964a5604cbb428bccd88" - integrity sha512-unsHk3kjqlA4nkClkpmhNVK1c2oxAEuX66z4RsM19gvSPstqECRlCIpb1KboKh9tjofRBaOzQbj8vTZDqqsXmA== +"@opencrvs/toolkit@0.0.13-events": + version "0.0.13-events" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.13-events.tgz#7b2c1fd73bba74c2cb6292a0ce4c6659e9711ee3" + integrity sha512-sdST83RXETbP6e1ETtM7VSUP2W+sYpz/DU9a8c036QlJ67I9306nuIqLePGU62pPggI8sI63fa2PL38bF3hAlg== dependencies: ajv "^8.17.1"