Skip to content

Commit 0e530d7

Browse files
authored
Merge pull request #1139 from opencrvs/custom-actions-config
Remove Validate and Register actions `review`, upgrade zod
2 parents 60f168e + d460351 commit 0e530d7

File tree

5 files changed

+46
-65
lines changed

5 files changed

+46
-65
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@hapi/boom": "^9.1.1",
7070
"@hapi/hapi": "^20.0.1",
7171
"@hapi/inert": "^6.0.3",
72-
"@opencrvs/toolkit": "1.9.0-rc.f73868a",
72+
"@opencrvs/toolkit": "1.9.0-rc.f2d330d",
7373
"@types/chalk": "^2.2.0",
7474
"@types/csv2json": "^1.4.0",
7575
"@types/fhir": "^0.0.30",
@@ -114,7 +114,7 @@
114114
"tsconfig-paths": "^3.8.0",
115115
"typescript": "^5.1.6",
116116
"uuid": "^11.1.0",
117-
"zod": "^3.24.1"
117+
"zod": "^4.1.12"
118118
},
119119
"lint-staged": {
120120
"src/**/*.{ts,graphql}": [

src/form/tennis-club-membership.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -827,14 +827,6 @@ export const tennisClubMembershipEvent = defineConfig({
827827
description:
828828
'This is shown as the action name anywhere the user can trigger the action from',
829829
id: 'event.tennis-club-membership.action.validate.label'
830-
},
831-
review: {
832-
title: {
833-
defaultMessage: 'Validate',
834-
description: 'Title of the form to show in review page',
835-
id: 'event.birth.action.validate.form.review.title'
836-
},
837-
fields: []
838830
}
839831
},
840832
{
@@ -844,14 +836,6 @@ export const tennisClubMembershipEvent = defineConfig({
844836
description:
845837
'This is shown as the action name anywhere the user can trigger the action from',
846838
id: 'event.tennis-club-membership.action.register.label'
847-
},
848-
review: {
849-
title: {
850-
defaultMessage: 'Register',
851-
description: 'Title of the form to show in review page',
852-
id: 'event.birth.action.register.form.review.title'
853-
},
854-
fields: []
855839
}
856840
},
857841
{

src/form/v2/birth/index.ts

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
*/
1111
import {
1212
ActionType,
13+
and,
1314
ConditionalType,
1415
defineConfig,
15-
field
16+
field,
17+
not
1618
} from '@opencrvs/toolkit/events'
1719
import {
1820
BIRTH_DECLARATION_FORM,
@@ -24,6 +26,7 @@ import { BIRTH_CERTIFICATE_COLLECTOR_FORM } from './forms/printForm'
2426
import { PlaceOfBirth } from './forms/pages/child'
2527
import { CORRECTION_FORM } from './forms/correctionForm'
2628
import { dedupConfig } from './dedupConfig'
29+
import { applicationConfig } from '@countryconfig/api/application/application-config'
2730

2831
export const birthEvent = defineConfig({
2932
id: Event.Birth,
@@ -45,6 +48,17 @@ export const birthEvent = defineConfig({
4548
description:
4649
'This is a fallback title if actual title resolves to empty string'
4750
},
51+
flags: [
52+
{
53+
id: 'approval-required-for-late-registration',
54+
label: {
55+
id: 'event.birth.flag.approval-required-for-late-registration',
56+
defaultMessage: 'Approval required for late registration',
57+
description: 'Flag label for approval required for late registration'
58+
},
59+
requiresAction: true
60+
}
61+
],
4862
summary: {
4963
fields: [
5064
{
@@ -188,7 +202,22 @@ export const birthEvent = defineConfig({
188202
id: 'event.birth.action.detect-duplicate.label'
189203
},
190204
query: dedupConfig
191-
}
205+
},
206+
flags: [
207+
{
208+
id: 'approval-required-for-late-registration',
209+
operation: 'add',
210+
conditional: and(
211+
not(
212+
field('child.dob')
213+
.isAfter()
214+
.days(applicationConfig.BIRTH.LATE_REGISTRATION_TARGET)
215+
.inPast()
216+
),
217+
field('child.dob').isBefore().now()
218+
)
219+
}
220+
]
192221
},
193222
{
194223
type: ActionType.VALIDATE,
@@ -198,14 +227,6 @@ export const birthEvent = defineConfig({
198227
'This is shown as the action name anywhere the user can trigger the action from',
199228
id: 'event.birth.action.validate.label'
200229
},
201-
review: {
202-
title: {
203-
defaultMessage: 'Validate',
204-
description: 'Title of the form to show in review page',
205-
id: 'event.birth.action.validate.form.review.title'
206-
},
207-
fields: []
208-
},
209230
deduplication: {
210231
id: 'birth-deduplication',
211232
label: {
@@ -225,14 +246,6 @@ export const birthEvent = defineConfig({
225246
'This is shown as the action name anywhere the user can trigger the action from',
226247
id: 'event.birth.action.register.label'
227248
},
228-
review: {
229-
title: {
230-
defaultMessage: 'Register',
231-
description: 'Title of the form to show in review page',
232-
id: 'event.birth.action.register.form.review.title'
233-
},
234-
fields: []
235-
},
236249
deduplication: {
237250
id: 'birth-deduplication',
238251
label: {

src/form/v2/death/index.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,6 @@ export const deathEvent = defineConfig({
201201
'This is shown as the action name anywhere the user can trigger the action from',
202202
id: 'event.death.action.validate.label'
203203
},
204-
review: {
205-
title: {
206-
defaultMessage: 'Validate',
207-
description: 'Title of the form to show in review page',
208-
id: 'event.birth.action.validate.form.review.title'
209-
},
210-
fields: []
211-
},
212204
deduplication: {
213205
id: 'death-deduplication',
214206
label: {
@@ -228,14 +220,6 @@ export const deathEvent = defineConfig({
228220
'This is shown as the action name anywhere the user can trigger the action from',
229221
id: 'event.death.action.register.label'
230222
},
231-
review: {
232-
title: {
233-
defaultMessage: 'Register',
234-
description: 'Title of the form to show in review page',
235-
id: 'event.birth.action.register.form.review.title'
236-
},
237-
fields: []
238-
},
239223
deduplication: {
240224
id: 'death-deduplication',
241225
label: {

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,10 @@
834834
dependencies:
835835
"@octokit/openapi-types" "^18.0.0"
836836

837-
"@opencrvs/[email protected].f73868a":
838-
version "1.9.0-rc.f73868a"
839-
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.0-rc.f73868a.tgz#d21f3b037552584fc43a0a87af2fa735296c900a"
840-
integrity sha512-V6vO+/AlD4ravxeQnHEwPSwTZgdZwe3OZqJp2Z1M1VSA5iAhgRGHh3zZiRrlJto/PYSYS171WTzn/uZgEWB+4Q==
837+
"@opencrvs/[email protected].f2d330d":
838+
version "1.9.0-rc.f2d330d"
839+
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.0-rc.f2d330d.tgz#9a5d8597711bde3d7cdb5ab02126386d91afe6c9"
840+
integrity sha512-Ne+UMRbyHT7/YFXv/P8dW/qPujF3gUwtUUUHoxSI/JElKzmXIVVSbICVr35a0ko3NcrDpCPb1gCLCczYKIgS+g==
841841
dependencies:
842842
"@trpc/client" "11.4.3"
843843
"@trpc/server" "11.4.3"
@@ -846,7 +846,7 @@
846846
object-hash "^3.0.0"
847847
superjson "1.9.0-0"
848848
uuid "^9.0.0"
849-
zod-openapi "^4.2.4"
849+
zod-openapi "^5.4.3"
850850

851851
"@pkgjs/parseargs@^0.11.0":
852852
version "0.11.0"
@@ -5817,12 +5817,12 @@ yocto-queue@^0.1.0:
58175817
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
58185818
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
58195819

5820-
zod-openapi@^4.2.4:
5821-
version "4.2.4"
5822-
resolved "https://registry.yarnpkg.com/zod-openapi/-/zod-openapi-4.2.4.tgz#44a0ec81ace6d64d705c8e4232095fac313359cf"
5823-
integrity sha512-tsrQpbpqFCXqVXUzi3TPwFhuMtLN3oNZobOtYnK6/5VkXsNdnIgyNr4r8no4wmYluaxzN3F7iS+8xCW8BmMQ8g==
5820+
zod-openapi@^5.4.3:
5821+
version "5.4.3"
5822+
resolved "https://registry.yarnpkg.com/zod-openapi/-/zod-openapi-5.4.3.tgz#ec886fac181b778bc2e9ccc3462c470543f23e26"
5823+
integrity sha512-6kJ/gJdvHZtuxjYHoMtkl2PixCwRuZ/s79dVkEr7arHvZGXfx7Cvh53X3HfJ5h9FzGelXOXlnyjwfX0sKEPByw==
58245824

5825-
zod@^3.24.1:
5826-
version "3.24.1"
5827-
resolved "https://registry.yarnpkg.com/zod/-/zod-3.24.1.tgz#27445c912738c8ad1e9de1bea0359fa44d9d35ee"
5828-
integrity sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==
5825+
zod@^4.1.12:
5826+
version "4.1.12"
5827+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.12.tgz#64f1ea53d00eab91853195653b5af9eee68970f0"
5828+
integrity sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==

0 commit comments

Comments
 (0)