Skip to content

Commit ade498c

Browse files
committed
Merge branch 'develop' into merge-v1.9.1-to-develop
2 parents 7053579 + a763f1a commit ade498c

File tree

18 files changed

+266
-269
lines changed

18 files changed

+266
-269
lines changed

.github/workflows/publish-to-dockerhub.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,23 @@ jobs:
6969
echo "version=${GIT_HASH}-amd64" >> $GITHUB_OUTPUT
7070
fi
7171
72-
- name: Build and push
72+
- name: Build and push countryconfig image
7373
uses: docker/build-push-action@v6
7474
with:
7575
push: true
7676
context: .
7777
tags: |
7878
${{ secrets.DOCKERHUB_ACCOUNT}}/${{ secrets.DOCKERHUB_REPO }}:${{ steps.country_config.outputs.version }}
7979
80+
- name: Build and push metabase assets image
81+
uses: docker/build-push-action@v6
82+
with:
83+
push: true
84+
context: .
85+
file: ./Dockerfile.metabase.assets
86+
tags: |
87+
${{ secrets.DOCKERHUB_ACCOUNT}}/${{ secrets.DOCKERHUB_REPO }}:${{ steps.country_config.outputs.version }}-assets
88+
8089
merge-manifest:
8190
needs: [build]
8291
runs-on: ubuntu-latest
@@ -98,11 +107,17 @@ jobs:
98107
# Create manifest list based on whether ARM build exists
99108
if [[ "$BUILD_ARM" == "true" ]]; then
100109
MANIFEST_LIST="$REPO:$TAG-amd64 $REPO:$TAG-arm64"
110+
ASSETS_MANIFEST_LIST="$REPO:$TAG-amd64-assets $REPO:$TAG-arm64-assets"
101111
else
102112
MANIFEST_LIST="$REPO:$TAG-amd64"
113+
ASSETS_MANIFEST_LIST="$REPO:$TAG-amd64-assets"
103114
fi
104115
105116
echo "[🔁 pushing ] $REPO:$TAG"
106117
docker manifest create $REPO:$TAG \
107118
$MANIFEST_LIST
108119
docker manifest push $REPO:$TAG
120+
echo "[🔁 pushing ] $REPO:$TAG-assets"
121+
docker manifest create $REPO:$TAG-assets \
122+
$ASSETS_MANIFEST_LIST
123+
docker manifest push $REPO:$TAG-assets

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint-staged

.husky/pre-push

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
branch=$(git rev-parse --abbrev-ref HEAD)
4+
pattern='^[a-z][a-z0-9\/\-]{1,29}$'
5+
6+
if [[ ! "$branch" =~ $pattern ]]; then
7+
echo """
8+
❌ Invalid branch name: '$branch'
9+
➡️ Branch names must match regex: $pattern
10+
- Start with a lowercase letter
11+
- Can contain lowercase letters, numbers, and hyphens
12+
- Length between 2 and 30 characters
13+
- Slashes '/' are allowed for hierarchical branch names
14+
Example: ocrvs-12345, feature-login, fix-bug123, refactor-api
15+
"""
16+
exit 1
17+
fi
18+
19+
exit 0

Dockerfile.metabase.assets

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM alpine:3.20
2+
3+
# Directory inside the assets image
4+
WORKDIR /assets
5+
6+
# Copy assets
7+
COPY infrastructure/metabase /assets/
8+
9+
RUN chmod +x /assets/*.sh

infrastructure/metabase/run.sh

100644100755
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#
99
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
1010

11-
#!/bin/bash
11+
SCRIPT_FULL_PATH=$(readlink -f $0)
12+
SCRIPT_DIR=$(dirname "$SCRIPT_FULL_PATH")
13+
echo "Running Metabase initialization script from ${SCRIPT_DIR}"
1214

1315
if [ -z "${OPENCRVS_METABASE_SITE_NAME}" ]; then
1416
echo "Error: OPENCRVS_METABASE_SITE_NAME environment variable is not defined"
@@ -106,8 +108,8 @@ export OPENCRVS_METABASE_ADMIN_PASSWORD_SALT=$(uuidgen)
106108
SALT_AND_PASSWORD=$OPENCRVS_METABASE_ADMIN_PASSWORD_SALT$OPENCRVS_METABASE_ADMIN_PASSWORD
107109
export OPENCRVS_METABASE_ADMIN_PASSWORD_HASH=$(java -cp $METABASE_JAR clojure.main -e "(require 'metabase.util.password) (println (metabase.util.password/hash-bcrypt \"$SALT_AND_PASSWORD\"))" 2>/dev/null | tail -n 1)
108110

109-
source /initialize-database.sh
110-
source /update-database.sh
111+
source ${SCRIPT_DIR}/initialize-database.sh
112+
source ${SCRIPT_DIR}/update-database.sh
111113

112114
echo "Starting metabase..."
113115

infrastructure/postgres/setup-analytics.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ CREATE TABLE IF NOT EXISTS analytics.event_actions (
8585
UNIQUE (id, event_id)
8686
);
8787
88+
ALTER TABLE analytics.event_actions ADD COLUMN IF NOT EXISTS custom_action_type TEXT;
89+
8890
CREATE TABLE IF NOT EXISTS analytics.location_levels (
8991
id text PRIMARY KEY,
9092
level int NOT NULL,

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010
"node": "22.x.x"
1111
},
1212
"license": "MPL-2.0",
13-
"husky": {
14-
"hooks": {
15-
"pre-commit": "yarn precommit"
16-
}
17-
},
1813
"scripts": {
1914
"dev": "yarn start",
20-
"precommit": "lint-staged",
2115
"test": "vitest",
2216
"test:compilation": "tsc --noEmit",
2317
"lint": "eslint -c .eslintrc.js",
@@ -50,7 +44,7 @@
5044
"eslint": "^8.43.0",
5145
"eslint-config-prettier": "^9.1.0",
5246
"eslint-plugin-prettier": "^5.2.1",
53-
"husky": "1.0.0-rc.13",
47+
"husky": "^9.1.7",
5448
"inquirer": "^9.2.12",
5549
"js-yaml": "^4.1.0",
5650
"kleur": "^4.1.5",
@@ -69,7 +63,7 @@
6963
"@hapi/boom": "^9.1.1",
7064
"@hapi/hapi": "^20.0.1",
7165
"@hapi/inert": "^6.0.3",
72-
"@opencrvs/toolkit": "1.9.0-rc.79b0f42",
66+
"@opencrvs/toolkit": "1.9.0-rc.1346624",
7367
"@types/chalk": "^2.2.0",
7468
"@types/csv2json": "^1.4.0",
7569
"@types/fhir": "^0.0.30",
@@ -114,7 +108,7 @@
114108
"tsconfig-paths": "^3.8.0",
115109
"typescript": "^5.1.6",
116110
"uuid": "^11.1.0",
117-
"zod": "^3.24.1"
111+
"zod": "^4.1.12"
118112
},
119113
"lint-staged": {
120114
"src/**/*.{ts,graphql}": [
@@ -129,5 +123,8 @@
129123
},
130124
"resolutions": {
131125
"acorn": "^6.4.1"
126+
},
127+
"husky": {
128+
"hooks": {}
132129
}
133130
}

src/api/custom-event/handler.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export function getCustomEventsHandler(
2424
.code(200)
2525
}
2626

27+
export async function onCustomActionHandler(
28+
request: ActionConfirmationRequest,
29+
h: Hapi.ResponseToolkit
30+
) {
31+
return h.response().code(200)
32+
}
33+
2734
export async function onAnyActionHandler(
2835
request: ActionConfirmationRequest,
2936
h: Hapi.ResponseToolkit
@@ -33,6 +40,7 @@ export async function onAnyActionHandler(
3340
const token = request.auth.artifacts.token as string
3441

3542
const event = request.payload
43+
3644
await sendInformantNotification({ event, token })
3745

3846
return h.response().code(200)

src/api/notification/informantNotification.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import { InformantType as BirthInformantType } from '@countryconfig/form/v2/birt
2626
import { InformantTemplateType } from './sms-service'
2727
import { generateFailureLog, NotificationParams, notify } from './handler'
2828
import { InformantType as DeathInformantType } from '@countryconfig/form/v2/death/forms/pages/informant'
29-
import { birthEvent } from '@countryconfig/form/v2/birth'
30-
import { deathEvent } from '@countryconfig/form/v2/death'
3129

3230
const resolveName = (name: FieldUpdateValue) => {
3331
const nameObj = {
@@ -77,18 +75,6 @@ function getInformant(eventType: string, declaration: Record<string, any>) {
7775
throw new Error('Invalid event type')
7876
}
7977

80-
function getEventConfig(eventType: string) {
81-
if (eventType === Event.Birth) {
82-
return birthEvent
83-
}
84-
85-
if (eventType === Event.Death) {
86-
return deathEvent
87-
}
88-
89-
throw new Error('Invalid event type')
90-
}
91-
9278
async function getNotificationParams(
9379
event: EventDocument,
9480
token: string,

src/api/workqueue/workqueueConfig.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export const Workqueues = defineWorkqueues([
166166
terms: ['DECLARED', 'NOTIFIED']
167167
},
168168
flags: {
169-
noneOf: [InherentFlags.REJECTED]
169+
noneOf: [InherentFlags.REJECTED, 'validated']
170170
},
171171
createdBy: { type: 'exact', term: user('id') }
172172
},
@@ -194,7 +194,7 @@ export const Workqueues = defineWorkqueues([
194194
query: {
195195
status: { type: 'exact', term: EventStatus.enum.DECLARED },
196196
flags: {
197-
noneOf: [InherentFlags.REJECTED]
197+
noneOf: [InherentFlags.REJECTED, 'validated']
198198
},
199199
updatedAtLocation: { type: 'exact', term: user('primaryOfficeId') }
200200
},
@@ -230,7 +230,7 @@ export const Workqueues = defineWorkqueues([
230230
{
231231
status: {
232232
type: 'anyOf',
233-
terms: ['DECLARED', 'VALIDATED']
233+
terms: ['DECLARED']
234234
},
235235
flags: {
236236
noneOf: [InherentFlags.REJECTED]
@@ -341,15 +341,10 @@ export const Workqueues = defineWorkqueues([
341341
clauses: [
342342
{
343343
updatedBy: { type: 'exact', term: user('id') },
344-
status: { type: 'exact', term: 'VALIDATED' },
345-
flags: {
346-
noneOf: [InherentFlags.REJECTED]
347-
}
344+
flags: { noneOf: [InherentFlags.REJECTED] }
348345
},
349346
{
350-
flags: {
351-
anyOf: [InherentFlags.CORRECTION_REQUESTED]
352-
},
347+
flags: { anyOf: [InherentFlags.CORRECTION_REQUESTED, 'validated'] },
353348
updatedBy: { type: 'exact', term: user('id') }
354349
}
355350
]

0 commit comments

Comments
 (0)