Repository navigation
VIBE-300 Add subscription by case name and case number #318
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
Closed
Closed
Changes from 27 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
40fc569
Add technical planning for VIBE-316: Refactor artefact search extract…
github-actions[bot] 0b4022e
feat(VIBE-316): Refactor artefact search extraction and subscription …
KianKwa fea592d
Merge remote-tracking branch 'origin/master' into feature/VIBE-316-re…
KianKwa e705dc2
Removed script
KianKwa 6b509fc
fix(VIBE-316): Fix TypeScript errors from schema changes
KianKwa 43a17dd
Add list search config migration
KianKwa c30929d
feat(VIBE-316): Remove locationId column from subscription table
KianKwa 8e7ba8b
feat(VIBE-316): Register list-search-config module in web app
KianKwa 50b7a93
fix(VIBE-316): Fix list-search-config route parameter syntax
KianKwa 0e7d218
fix: Rename Nunjucks template to avoid bracket syntax issues
KianKwa 09eaa5a
fix: Add list-search-config moduleRoot to Nunjucks template paths
KianKwa f010f71
fix: Correct Nunjucks template layout and block names
KianKwa b708199
fix: Change redirect to go back to same page after save
KianKwa 9b17abe
fix: Add explicit action attribute to form
KianKwa c88a263
fix: Add explicit type='submit' to button
KianKwa d258885
fix: Replace govukButton macro with plain HTML button
KianKwa 3f12884
Add list type configuration pages
KianKwa 93e3763
Move list search config pages
KianKwa ce02681
Update unit tests
KianKwa aa595ec
Restructure code
KianKwa 6e50afa
Update logic
KianKwa db4d6db
Removed test file
KianKwa 9b471f0
Fixed failing unit and e2e tests
KianKwa 4b291b5
Add e2e tests for manage list types
KianKwa cf2fc1b
Code restructuring
KianKwa 72ba7da
Fix security vuln
KianKwa dfd7c8d
Add subscription by case name and case number
KianKwa 1211b85
Update tests and fix security vuln
KianKwa b19aed5
Fix issue with duplicate case name in pending subscriptions
KianKwa 575425c
Fixed failing e2e tests
KianKwa 9c14f67
Verified pages code tidy up
KianKwa d203b02
Code refactoring
KianKwa 6a3944e
Fixed failing unit test
KianKwa 234b0a6
FIx issue with duplicated case subscriptions
KianKwa f6ba7c5
Removed redundant logs
KianKwa d48b005
Update Welsh translations
KianKwa 3fecac1
Lint fix
KianKwa 570dbe7
Update id to use uuid
KianKwa 08bd06a
Merge branch 'feature/VIBE-316-refactor-artefact-search-extraction-su…
KianKwa db463d8
Update id to use uuid
KianKwa 00bffba
Merge branch 'feature/VIBE-316-refactor-artefact-search-extraction-su…
KianKwa 59f315b
Merge branch 'master' into feature/VIBE-316-refactor-artefact-search-…
KianKwa cd1a23a
Fix merge issue
KianKwa 74f3056
Merge remote-tracking branch 'origin/master' into feature/VIBE-316-re…
KianKwa b9d9278
Merge branch 'feature/VIBE-316-refactor-artefact-search-extraction-su…
KianKwa f450188
Fix merge issue
KianKwa 76627a0
Merge branch 'feature/VIBE-316-refactor-artefact-search-extraction-su…
KianKwa c1f1db8
Fix unit test issue
KianKwa 6ea83b2
Fix unit test issue
KianKwa 10904ff
Add validation to list-search-config page
KianKwa 16d3d4f
Fixed security vuln
KianKwa 630d3ef
Merge branch 'feature/VIBE-316-refactor-artefact-search-extraction-su…
KianKwa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
apps/postgres/prisma/migrations/20260119150000_add_list_search_config/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "list_search_config" ( | ||
| "id" TEXT NOT NULL, | ||
| "list_type_id" INTEGER NOT NULL, | ||
| "case_number_field_name" VARCHAR(100) NOT NULL, | ||
| "case_name_field_name" VARCHAR(100) NOT NULL, | ||
| "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updated_at" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "list_search_config_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "list_search_config_list_type_id_key" ON "list_search_config"("list_type_id"); |
37 changes: 37 additions & 0 deletions
37
...sma/migrations/20260119151000_refactor_subscription_and_add_artefact_search/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| -- DropForeignKey | ||
| ALTER TABLE "subscription" DROP CONSTRAINT IF EXISTS "subscription_location_id_fkey"; | ||
|
|
||
| -- DropIndex | ||
| DROP INDEX IF EXISTS "idx_subscription_location"; | ||
|
|
||
| -- DropIndex | ||
| DROP INDEX IF EXISTS "unique_user_location"; | ||
|
|
||
| -- AlterTable | ||
| ALTER TABLE "subscription" | ||
| ADD COLUMN "search_type" VARCHAR(50) NOT NULL, | ||
| ADD COLUMN "search_value" TEXT NOT NULL, | ||
| DROP COLUMN IF EXISTS "location_id"; | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "artefact_search" ( | ||
| "id" TEXT NOT NULL, | ||
| "artefact_id" UUID NOT NULL, | ||
| "case_number" TEXT, | ||
| "case_name" TEXT, | ||
| "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "artefact_search_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "artefact_search_artefact_id_idx" ON "artefact_search"("artefact_id"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "idx_subscription_search" ON "subscription"("search_type", "search_value"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "subscription_user_id_search_type_search_value_key" ON "subscription"("user_id", "search_type", "search_value"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "artefact_search" ADD CONSTRAINT "artefact_search_artefact_id_fkey" FOREIGN KEY ("artefact_id") REFERENCES "artefact"("artefact_id") ON DELETE CASCADE ON UPDATE CASCADE; |
6 changes: 6 additions & 0 deletions
6
...sma/migrations/20260122150011_add_case_name_and_case_number_to_subscription/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "subscription" ADD COLUMN "case_name" TEXT, | ||
| ADD COLUMN "case_number" TEXT; | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "idx_subscription_case_number" ON "subscription"("case_number"); |
5 changes: 5 additions & 0 deletions
5
...isma/migrations/20260123151728_add_cascade_delete_to_notification_audit_log/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| -- DropForeignKey | ||
| ALTER TABLE "notification_audit_log" DROP CONSTRAINT "notification_audit_log_subscription_id_fkey"; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "notification_audit_log" ADD CONSTRAINT "notification_audit_log_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "subscription"("subscription_id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { prisma } from "@hmcts/postgres"; | ||
|
|
||
| async function migrateSubscriptions() { | ||
| console.log("Starting subscription data migration..."); | ||
|
|
||
| const subscriptions = await prisma.subscription.findMany({ | ||
| where: { | ||
| searchType: null | ||
| } | ||
| }); | ||
|
|
||
| console.log(`Found ${subscriptions.length} subscriptions to migrate`); | ||
|
|
||
| let migratedCount = 0; | ||
| let errorCount = 0; | ||
|
|
||
| for (const subscription of subscriptions) { | ||
| try { | ||
| if (subscription.locationId) { | ||
| await prisma.subscription.update({ | ||
| where: { | ||
| subscriptionId: subscription.subscriptionId | ||
| }, | ||
| data: { | ||
| searchType: "LOCATION_ID", | ||
| searchValue: subscription.locationId.toString() | ||
| } | ||
| }); | ||
| migratedCount++; | ||
| } | ||
| } catch (error) { | ||
| console.error(`Failed to migrate subscription ${subscription.subscriptionId}:`, error); | ||
| errorCount++; | ||
| } | ||
| } | ||
|
|
||
| console.log(`Migration completed:`); | ||
| console.log(` - Successfully migrated: ${migratedCount}`); | ||
| console.log(` - Errors: ${errorCount}`); | ||
|
|
||
| const verifyCount = await prisma.subscription.count({ | ||
| where: { | ||
| searchType: "LOCATION_ID" | ||
| } | ||
| }); | ||
|
|
||
| console.log(`Verification: ${verifyCount} subscriptions now have searchType='LOCATION_ID'`); | ||
| } | ||
|
|
||
| migrateSubscriptions() | ||
| .catch((error) => { | ||
| console.error("Migration failed:", error); | ||
| process.exit(1); | ||
| }) | ||
| .finally(async () => { | ||
| await prisma.$disconnect(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| // Schema discovery functionality for module integration | ||
| import { prismaSchemas as listSearchConfigSchemas } from "@hmcts/list-search-config/config"; | ||
| import { prismaSchemas as locationSchemas } from "@hmcts/location/config"; | ||
| import { prismaSchemas as notificationsSchemas } from "@hmcts/notifications/config"; | ||
| import { prismaSchemas as subscriptionsSchemas } from "@hmcts/subscriptions/config"; | ||
| import { prismaSchemas as subscriptionSchemas } from "@hmcts/subscription/config"; | ||
|
|
||
| export function getPrismaSchemas(): string[] { | ||
| return [subscriptionsSchemas, locationSchemas, notificationsSchemas]; | ||
| return [subscriptionSchemas, locationSchemas, notificationsSchemas, listSearchConfigSchemas]; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.