Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events v2: add deduplication config for tennis club membership #363

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion src/form/tennis-club-membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
*/

import { defineConfig, defineForm } from '@opencrvs/toolkit/events'

import {
defineConditional,
or,
eventHasAction,
userHasScope,
and,
not,
field
field,
deduplication
} from '@opencrvs/toolkit/conditionals'

const TENNIS_CLUB_FORM = defineForm({
Expand Down Expand Up @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,10 @@
dependencies:
"@octokit/openapi-types" "^18.0.0"

"@opencrvs/[email protected].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/[email protected].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"

Expand Down
Loading