Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e24e24e
Add technical planning for VIBE-221: Subscription Email Notifications
github-actions[bot] Nov 21, 2025
4906e0f
Add technical planning documentation for VIBE-221
github-actions[bot] Nov 21, 2025
4ec68ca
Add technical planning for VIBE-221
github-actions[bot] Nov 22, 2025
c7956a7
Add technical planning documentation for VIBE-221
github-actions[bot] Nov 22, 2025
f314634
docs: Add technical plan for VIBE-221 - Email notification backend
github-actions[bot] Nov 22, 2025
a394aac
Merge branch 'master' into feature/VIBE-221-subscription-fulfilment-e…
junaidiqbalmoj Dec 1, 2025
dfe5ea0
WIP
junaidiqbalmoj Dec 1, 2025
b1fc68b
add notifications, fix tests
junaidiqbalmoj Dec 1, 2025
0f83f5e
Merge branch 'feature/VIBE-221-subscription-fulfilment-email' of http…
junaidiqbalmoj Dec 1, 2025
203d22c
chore: remove old notification library (singular)
junaidiqbalmoj Dec 1, 2025
010ca9c
fix: update import from @hmcts/notification to @hmcts/notifications
junaidiqbalmoj Dec 1, 2025
88f8587
revert changes
junaidiqbalmoj Dec 1, 2025
0611033
remove files not needed
junaidiqbalmoj Dec 1, 2025
0f756f6
fix: resolve govnotify-client test failure
junaidiqbalmoj Dec 1, 2025
874a266
fix: correct notification service API for manual uploads
junaidiqbalmoj Dec 1, 2025
1cec266
fix: make database migrations idempotent
junaidiqbalmoj Dec 1, 2025
72975eb
fix: remove duplicate conflicting migration
junaidiqbalmoj Dec 1, 2025
54f3093
fix: make notification audit log migration fully idempotent
junaidiqbalmoj Dec 1, 2025
8a31e67
fix sonar issue
junaidiqbalmoj Dec 1, 2025
bda15fa
add code coverage
junaidiqbalmoj Dec 1, 2025
7e59f0b
add end to end tests
junaidiqbalmoj Dec 1, 2025
96271e3
add end to end tests
junaidiqbalmoj Dec 1, 2025
b7dca26
fix bug
junaidiqbalmoj Dec 2, 2025
cb9ba2d
fix end to end tests
junaidiqbalmoj Dec 2, 2025
7d65b1b
end to end tests on pipeline
junaidiqbalmoj Dec 2, 2025
8137cbf
add readme file for github secret setup
junaidiqbalmoj Dec 2, 2025
698e4c3
fix build
junaidiqbalmoj Dec 2, 2025
c5f21bd
fix end to end tests build
junaidiqbalmoj Dec 2, 2025
728987e
fix end to end to use CFT verified user
junaidiqbalmoj Dec 2, 2025
62993b1
add subscription for location which exists in db
junaidiqbalmoj Dec 2, 2025
3f79d49
fix end to end tests
junaidiqbalmoj Dec 2, 2025
56bbb97
fix code review comments
junaidiqbalmoj Dec 2, 2025
72a0d7b
fix tests and code review comments
junaidiqbalmoj Dec 2, 2025
b1b3958
fix build
junaidiqbalmoj Dec 2, 2025
aafca23
Merge branch 'master' into feature/VIBE-221-subscription-fulfilment-e…
junaidiqbalmoj Dec 3, 2025
91ea006
fix bug
junaidiqbalmoj Dec 3, 2025
9fe6e4a
fix end to end tests
junaidiqbalmoj Dec 3, 2025
719c03c
fix build
junaidiqbalmoj Dec 3, 2025
61ad3b3
fix build
junaidiqbalmoj Dec 3, 2025
40a88ff
Delete .claude/.DS_Store
junaidiqbalmoj Dec 3, 2025
ce6dbca
refactoring
junaidiqbalmoj Dec 3, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
-- DropForeignKey (only if exists)
ALTER TABLE "ingestion_log" DROP CONSTRAINT IF EXISTS "fk_blob_artefact";

-- AlterTable (only if DEFAULT exists)
DO $$ BEGIN
IF EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'ingestion_log'
AND column_name = 'id'
AND column_default IS NOT NULL
) THEN
ALTER TABLE "ingestion_log" ALTER COLUMN "id" DROP DEFAULT;
END IF;
END $$;

-- CreateTable (only if not exists)
CREATE TABLE IF NOT EXISTS "notification_audit_log" (
"notification_id" UUID NOT NULL,
"subscription_id" UUID NOT NULL,
"user_id" UUID NOT NULL,
"publication_id" UUID NOT NULL,
"status" TEXT NOT NULL DEFAULT 'Pending',
"error_message" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"sent_at" TIMESTAMP(3),

CONSTRAINT "notification_audit_log_pkey" PRIMARY KEY ("notification_id")
);

-- CreateIndex (only if not exists)
CREATE INDEX IF NOT EXISTS "notification_audit_log_publication_id_idx" ON "notification_audit_log"("publication_id");

-- CreateIndex (only if not exists)
CREATE INDEX IF NOT EXISTS "notification_audit_log_status_idx" ON "notification_audit_log"("status");

-- CreateIndex (only if not exists)
CREATE UNIQUE INDEX IF NOT EXISTS "notification_audit_log_user_id_publication_id_key" ON "notification_audit_log"("user_id", "publication_id");

-- AddForeignKey (only if not exists)
DO $$ BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_constraint WHERE conname = 'ingestion_log_artefact_id_fkey'
) THEN
ALTER TABLE "ingestion_log" ADD CONSTRAINT "ingestion_log_artefact_id_fkey" FOREIGN KEY ("artefact_id") REFERENCES "artefact"("artefact_id") ON DELETE SET NULL ON UPDATE CASCADE;
END IF;
END $$;

-- AddForeignKey (only if not exists)
DO $$ BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_constraint WHERE conname = 'notification_audit_log_subscription_id_fkey'
) THEN
ALTER TABLE "notification_audit_log" ADD CONSTRAINT "notification_audit_log_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "subscription"("subscription_id") ON DELETE RESTRICT ON UPDATE CASCADE;
END IF;
END $$;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Add gov_notify_id column to notification_audit_log (idempotent)
DO $$ BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'notification_audit_log'
AND column_name = 'gov_notify_id'
) THEN
ALTER TABLE "notification_audit_log"
ADD COLUMN "gov_notify_id" TEXT;
END IF;
END $$;

-- Create index for gov_notify_id lookups (idempotent)
CREATE INDEX IF NOT EXISTS "notification_audit_log_gov_notify_id_idx"
ON "notification_audit_log"("gov_notify_id");
9 changes: 5 additions & 4 deletions apps/postgres/src/schema-discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ describe("Schema Discovery", () => {
expect(Array.isArray(result)).toBe(true);
});

it("should return array with subscriptions and location schemas", () => {
it("should return array with subscriptions, location, and notifications schemas", () => {
const result = getPrismaSchemas();
expect(result.length).toBe(2);
expect(result[0]).toContain("subscriptions");
expect(result[1]).toContain("location");
expect(result.length).toBe(3);
expect(result.some((path) => path.includes("subscriptions"))).toBe(true);
expect(result.some((path) => path.includes("location"))).toBe(true);
expect(result.some((path) => path.includes("notifications"))).toBe(true);
});

it("should return a new array on each call", () => {
Expand Down
3 changes: 2 additions & 1 deletion apps/postgres/src/schema-discovery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Schema discovery functionality for module integration
import { prismaSchemas as locationSchemas } from "@hmcts/location/config";
import { prismaSchemas as notificationsSchemas } from "@hmcts/notifications/config";
import { prismaSchemas as subscriptionsSchemas } from "@hmcts/subscriptions/config";

export function getPrismaSchemas(): string[] {
return [subscriptionsSchemas, locationSchemas];
return [subscriptionsSchemas, locationSchemas, notificationsSchemas];
}
Loading
Loading