-
Notifications
You must be signed in to change notification settings - Fork 3
feat: UT non-strategic publishing (UTCC, UTLC, UTAAC) #425 #669
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
Changes from all commits
ce18db9
541e542
1c6a61f
4aea6e1
0336361
ebf5fe2
f93f838
ed373c6
d9dc62a
005a0f4
41cb3d4
6c4b466
e7120b0
fd712ae
34ebecf
c138f5a
bf53613
03ad90c
4565cac
536e191
58e5764
f034299
6624fff
a50e526
1516ea1
9c68625
4049f54
f8190fb
457e92d
042fcf5
007b0dc
dc900f3
aeff5d5
b570248
1899afd
51185a8
8a4888a
f827654
e99fe15
1bd68e1
8182a62
84c3bb9
eea8430
134a6cd
4439272
b1da079
dad6849
f17e84b
61b9087
ecd5602
a599179
0e69fcd
8965698
90df108
08d5738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| -- AddForeignKey | ||
| DO $$ BEGIN | ||
| IF NOT EXISTS ( | ||
| SELECT 1 FROM information_schema.table_constraints | ||
| WHERE constraint_name = 'artefact_list_type_id_fkey' | ||
| AND table_name = 'artefact' | ||
| ) THEN | ||
| ALTER TABLE "artefact" ADD CONSTRAINT "artefact_list_type_id_fkey" FOREIGN KEY ("list_type_id") REFERENCES "list_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
| END IF; | ||
| END $$; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,25 +40,26 @@ async function seedReferenceData() { | |
| }); | ||
| } | ||
| console.log(`Seeded ${locationData.jurisdictions.length} jurisdictions`); | ||
|
|
||
| console.log("Seeding sub-jurisdictions..."); | ||
| for (const subJurisdiction of locationData.subJurisdictions) { | ||
| await prisma.subJurisdiction.upsert({ | ||
| where: { subJurisdictionId: subJurisdiction.subJurisdictionId }, | ||
| create: { | ||
| subJurisdictionId: subJurisdiction.subJurisdictionId, | ||
| name: subJurisdiction.name, | ||
| welshName: subJurisdiction.welshName, | ||
| jurisdictionId: subJurisdiction.jurisdictionId | ||
| }, | ||
| update: { name: subJurisdiction.name, welshName: subJurisdiction.welshName, jurisdictionId: subJurisdiction.jurisdictionId } | ||
| }); | ||
| } | ||
| console.log(`Seeded ${locationData.subJurisdictions.length} sub-jurisdictions`); | ||
| } else { | ||
| console.log("Skipping location seed: tables already contain data"); | ||
| } | ||
|
|
||
| // Always upsert sub-jurisdictions to pick up new entries | ||
| console.log("Seeding sub-jurisdictions..."); | ||
| for (const subJurisdiction of locationData.subJurisdictions) { | ||
| await prisma.subJurisdiction.upsert({ | ||
| where: { subJurisdictionId: subJurisdiction.subJurisdictionId }, | ||
| create: { | ||
| subJurisdictionId: subJurisdiction.subJurisdictionId, | ||
| name: subJurisdiction.name, | ||
| welshName: subJurisdiction.welshName, | ||
| jurisdictionId: subJurisdiction.jurisdictionId | ||
| }, | ||
| update: { name: subJurisdiction.name, welshName: subJurisdiction.welshName, jurisdictionId: subJurisdiction.jurisdictionId } | ||
| }); | ||
| } | ||
| console.log(`Seeded ${locationData.subJurisdictions.length} sub-jurisdictions`); | ||
|
|
||
|
Comment on lines
+47
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reference seeding is still partially gated, so new location records can be missed. Line 47 always upserts sub-jurisdictions, but regions/jurisdictions/locations are still gated by |
||
| // Always run list type seeding to pick up new entries | ||
| console.log("Seeding list types..."); | ||
| const allSubJurisdictions = await prisma.subJurisdiction.findMany(); | ||
|
|
@@ -222,6 +223,7 @@ async function main() { | |
| console.log("Starting seed..."); | ||
| await seedReferenceData(); | ||
| await seedTestData(); | ||
|
|
||
| console.log("Seed completed successfully!"); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,10 @@ if [ -d "/mnt/secrets" ]; then | |
| if [ -d "$vault_dir" ]; then | ||
| for secret in "$vault_dir"*; do | ||
| name=$(basename "$secret") | ||
| # Skip CSI driver internal entries (start with ..) | ||
| case "$name" in | ||
| ..*) continue ;; | ||
| esac | ||
| # Check for regular file or symlink pointing to a file | ||
| if [ -f "$secret" ] || [ -L "$secret" ]; then | ||
| # Verify it's not a symlink to a directory | ||
| if [ ! -d "$secret" ]; then | ||
| value=$(cat "$secret") | ||
| export "$name"="$value" | ||
|
|
@@ -30,24 +27,22 @@ fi | |
|
|
||
| echo "Resolving any failed migrations..." | ||
| printf "UPDATE _prisma_migrations SET rolled_back_at = NOW() WHERE finished_at IS NULL AND rolled_back_at IS NULL AND started_at IS NOT NULL;" | \ | ||
| npx prisma db execute --stdin --config=./prisma.config.ts 2>/dev/null || true | ||
| npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts 2>/dev/null || true | ||
|
|
||
| echo "Clearing stale migration records for removed migrations..." | ||
| printf "DELETE FROM _prisma_migrations WHERE migration_name IN ('20260527140208', '20260528115459_add_third_party_push_log');" | \ | ||
| npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts 2>/dev/null || true | ||
|
Comment on lines
29
to
+34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle repair SQL failures explicitly rather than suppressing all errors. Line 30 and Line 34 suppress stderr and force success with Suggested change echo "Resolving any failed migrations..."
-printf "UPDATE _prisma_migrations SET rolled_back_at = NOW() WHERE finished_at IS NULL AND rolled_back_at IS NULL AND started_at IS NOT NULL;" | \
- npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts 2>/dev/null || true
-
-echo "Clearing stale migration records for removed migrations..."
-printf "DELETE FROM _prisma_migrations WHERE migration_name IN ('20260527140208', '20260528115459_add_third_party_push_log');" | \
- npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts 2>/dev/null || true
+if npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts >/dev/null 2>&1 <<'SQL'
+SELECT 1 FROM _prisma_migrations LIMIT 1;
+SQL
+then
+ printf "UPDATE _prisma_migrations SET rolled_back_at = NOW() WHERE finished_at IS NULL AND rolled_back_at IS NULL AND started_at IS NOT NULL;" | \
+ npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts
+ echo "Clearing stale migration records for removed migrations..."
+ printf "DELETE FROM _prisma_migrations WHERE migration_name IN ('20260527140208', '20260528115459_add_third_party_push_log');" | \
+ npx --ignore-scripts prisma db execute --stdin --config=./prisma.config.ts
+else
+ echo "_prisma_migrations not initialised yet; skipping repair SQL."
+fi |
||
|
|
||
| echo "Running database migrations..." | ||
| npx prisma migrate deploy --config=./prisma.config.ts | ||
|
|
||
| if [ $? -eq 0 ]; then | ||
| echo "Migrations completed successfully" | ||
| echo "Starting health proxy on port 5555..." | ||
| node health-server.mjs & | ||
| HEALTH_PID=$! | ||
|
|
||
| echo "Starting Prisma Studio on port 5556..." | ||
| npx prisma studio --config=./prisma.config.ts --port 5556 --browser none & | ||
| STUDIO_PID=$! | ||
|
|
||
| # Wait for both processes | ||
| wait $HEALTH_PID $STUDIO_PID | ||
| else | ||
| echo "Migration failed, exiting..." | ||
| exit 1 | ||
| fi | ||
| npx --ignore-scripts prisma migrate deploy --config=./prisma.config.ts | ||
|
|
||
| echo "Migrations completed successfully" | ||
| echo "Starting health proxy on port 5555..." | ||
| node health-server.mjs & | ||
| HEALTH_PID=$! | ||
|
|
||
| echo "Starting Prisma Studio on port 5556..." | ||
| npx --ignore-scripts prisma studio --config=./prisma.config.ts --port 5556 --browser none & | ||
| STUDIO_PID=$! | ||
|
|
||
| wait $HEALTH_PID $STUDIO_PID | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| export const cy = { | ||
| pageTitle: "[Welsh] Non-strategic upload - File upload summary - Court and tribunal hearings - GOV.UK", | ||
| heading: "[Welsh] File upload summary", | ||
| subHeading: "[Welsh] Check upload details", | ||
| courtName: "[Welsh] Court name", | ||
| file: "[Welsh] File", | ||
| listType: "[Welsh] List type", | ||
| hearingStartDate: "[Welsh] Hearing start date", | ||
| sensitivity: "[Welsh] Sensitivity", | ||
| language: "[Welsh] Language", | ||
| displayFileDates: "[Welsh] Display file dates", | ||
| change: "[Welsh] Change", | ||
| confirmButton: "[Welsh] Confirm" | ||
| pageTitle: "Llwytho i fyny â llaw - Crynodeb lanlwytho ffeil - Gwrandawiadau llys a thribiwnlys - GOV.UK", | ||
| heading: "Crynodeb lanlwytho ffeil", | ||
| subHeading: "Gwirio manylion lanlwytho", | ||
| courtName: "Enw'r llys", | ||
| file: "Ffeil", | ||
| listType: "Math o restr", | ||
| hearingStartDate: "Dyddiad cychwyn y gwrandawiad", | ||
| sensitivity: "Sensitifrwydd", | ||
| language: "Iaith", | ||
| displayFileDates: "Dangos dyddiadau ffeil", | ||
| change: "Newid", | ||
| confirmButton: "Cadarnhau" | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,60 @@ | ||
| export const cy = { | ||
| title: "[Welsh] Upload Excel file", | ||
| pageTitle: "[Welsh] Upload - Upload Excel file", | ||
| warningTitle: "[Welsh] Warning", | ||
| warningMessage: | ||
| "[Welsh] Prior to upload you must ensure the file is suitable for publication e.g. redaction of personal data has been done during the production of this file.", | ||
| fileUploadLabel: "[Welsh] Manually upload an Excel file (.xlsx), max size 2MB", | ||
| courtLabel: "[Welsh] Court name or Tribunal name", | ||
| listTypeLabel: "[Welsh] List type", | ||
| listTypePlaceholder: "[Welsh] Please choose a list type", | ||
| hearingStartDateLabel: "[Welsh] Hearing start date", | ||
| hearingStartDateHint: "[Welsh] For example, 16 01 2022", | ||
| sensitivityLabel: "[Welsh] Sensitivity", | ||
| languageLabel: "[Welsh] Language", | ||
| displayFromLabel: "[Welsh] Display file from", | ||
| displayFromHint: "[Welsh] For example, 27 01 2022", | ||
| displayToLabel: "[Welsh] Display file to", | ||
| displayToHint: "[Welsh] For example, 18 02 2022", | ||
| continueButton: "[Welsh] Continue", | ||
| errorSummaryTitle: "[Welsh] There is a problem", | ||
| pageHelpTitle: "[Welsh] Page help", | ||
| pageHelpLists: "[Welsh] Lists", | ||
| title: "Llwytho â llaw", | ||
| pageTitle: "Llwytho - Llwytho â llaw", | ||
| warningTitle: "Rhybudd", | ||
| warningMessage: "Cyn llwytho rhaid i chi sicrhau bod y ffeil yn addas i'w chyhoeddi e.e. bod data personol wedi'i olygu yn ystod cynhyrchu'r ffeil hon.", | ||
| fileUploadLabel: "Llwytho ffeil Excel (.xlsx) â llaw, uchafswm maint 2MB", | ||
| courtLabel: "Enw'r llys neu enw'r tribiwnlys", | ||
| listTypeLabel: "Math o restr", | ||
| listTypePlaceholder: "Dewiswch fath o restr", | ||
| hearingStartDateLabel: "Dyddiad dechrau'r gwrandawiad", | ||
| hearingStartDateHint: "Er enghraifft, 16 01 2022", | ||
| sensitivityLabel: "Sensitifrwydd", | ||
| languageLabel: "Iaith", | ||
| displayFromLabel: "Dangos y ffeil o", | ||
| displayFromHint: "Er enghraifft, 27 01 2022", | ||
| displayToLabel: "Dangos y ffeil tan", | ||
| displayToHint: "Er enghraifft, 18 02 2022", | ||
| continueButton: "Parhau", | ||
| errorSummaryTitle: "Mae yna broblem", | ||
| pageHelpTitle: "Cymorth tudalen", | ||
| pageHelpLists: "Rhestrau", | ||
| pageHelpListsText: | ||
| "[Welsh] You must ensure that you only upload one file that contains all hearings for the Court or Tribunal name and List type. This should include all judges and court rooms in one document.", | ||
| pageHelpSensitivity: "[Welsh] Sensitivity", | ||
| pageHelpSensitivityText: "[Welsh] You need to indicate which user group your document should be available to:", | ||
| pageHelpSensitivityPublic: "[Welsh] Public", | ||
| pageHelpSensitivityPublicText: "[Welsh] Publication available to all users.", | ||
| pageHelpSensitivityPrivate: "[Welsh] Private", | ||
| pageHelpSensitivityPrivateText: "[Welsh] Publication available to all verified users e.g. Legal professionals and media.", | ||
| pageHelpSensitivityClassified: "[Welsh] Classified", | ||
| "Rhaid i chi sicrhau eich bod chi ond yn llwytho un ffeil sy'n cynnwys yr holl wrandawiadau ar gyfer enw'r Llys neu'r Tribiwnlys a'r math o restr. Dylai hyn gynnwys pob barnwr ac ystafell lys mewn un ddogfen.", | ||
| pageHelpSensitivity: "Sensitifrwydd", | ||
| pageHelpSensitivityText: "Mae angen i chi nodi pa grŵp defnyddwyr y dylai eich dogfen fod ar gael iddynt:", | ||
| pageHelpSensitivityPublic: "Cyhoeddus", | ||
| pageHelpSensitivityPublicText: "Cyhoeddiad ar gael i bob defnyddiwr.", | ||
| pageHelpSensitivityPrivate: "Preifat", | ||
| pageHelpSensitivityPrivateText: "Cyhoeddiad ar gael i bob defnyddiwr wedi'u dilysu e.e. Gweithwyr proffesiynol cyfreithiol a'r cyfryngau.", | ||
| pageHelpSensitivityClassified: "Dosbarthedig", | ||
| pageHelpSensitivityClassifiedText: | ||
| "[Welsh] Publication only available to verified users who are in a group eligible to view that list e.g. SJP press list available to Media.", | ||
| pageHelpDisplayFrom: "[Welsh] Display from", | ||
| pageHelpDisplayFromText: "[Welsh] This will be the date the publication is available from … displayed immediately if today's date is used.", | ||
| pageHelpDisplayTo: "[Welsh] Display to", | ||
| pageHelpDisplayToText: "[Welsh] This will be the last date the publication is available. It will be displayed until 23:59 of that date.", | ||
| dayLabel: "[Welsh] Day", | ||
| monthLabel: "[Welsh] Month", | ||
| yearLabel: "[Welsh] Year", | ||
| backToTop: "[Welsh] Back to top", | ||
| "Cyhoeddiad ar gael i ddefnyddwyr wedi'u dilysu sydd mewn grŵp sy'n gymwys i weld y rhestr honno e.e. Rhestr y wasg SJP ar gael i'r Cyfryngau", | ||
| pageHelpDisplayFrom: "Dangos o", | ||
| pageHelpDisplayFromText: | ||
| "Hwn fydd y dyddiad y bydd y cyhoeddiad ar gael ohono, os defnyddir dyddiad heddiw bydd yn cael ei ddangos ar unwaith. Os defnyddir dyddiad yn y dyfodol, bydd yn cael ei ddangos o 00:01 ar y dyddiad hwnnw.", | ||
| pageHelpDisplayTo: "Dangos tan", | ||
| pageHelpDisplayToText: "Hwn fydd y dyddiad olaf y bydd y cyhoeddiad ar gael. Bydd yn cael ei ddangos tan 23:59 ar y dyddiad hwnnw.", | ||
| dayLabel: "Diwrnod", | ||
| monthLabel: "Mis", | ||
| yearLabel: "Blwyddyn", | ||
| backToTop: "Nôl i'r brig", | ||
|
|
||
| errorMessages: { | ||
| fileRequired: "[Welsh] Please provide a file", | ||
| fileType: "[Welsh] The selected file type is not supported", | ||
| fileSize: "[Welsh] The selected file must be smaller than 2MB", | ||
| courtRequired: "[Welsh] Please enter and select a valid court", | ||
| courtTooShort: "[Welsh] Court name must be three characters or more", | ||
| listTypeRequired: "[Welsh] Please select a list type", | ||
| hearingStartDateRequired: "[Welsh] Please enter a valid hearing start date", | ||
| hearingStartDateInvalid: "[Welsh] Please enter a valid hearing start date", | ||
| sensitivityRequired: "[Welsh] Please select a sensitivity", | ||
| languageRequired: "[Welsh] Select a language option", | ||
| displayFromRequired: "[Welsh] Please enter a valid display file from date", | ||
| displayFromInvalid: "[Welsh] Please enter a valid display file from date", | ||
| displayToRequired: "[Welsh] Please enter a valid display file to date", | ||
| displayToInvalid: "[Welsh] Please enter a valid display file to date", | ||
| displayToBeforeFrom: "[Welsh] 'Display to' date must be the same as or later than 'Display from' date" | ||
| fileRequired: "Darparwch ffeil", | ||
| fileType: "Llwythwch fformat ffeil dilys", | ||
| fileSize: "Ffeil yn rhy fawr, llwythwch ffeil yn llai na 2MB", | ||
| courtRequired: "Rhowch a dewiswch lys dilys", | ||
| courtTooShort: "Rhaid i enw'r llys fod yn dri chymeriad neu fwy", | ||
| listTypeRequired: "Dewiswch fath o restr", | ||
| hearingStartDateRequired: "Rhowch ddyddiad dechrau gwrandawiad dilys", | ||
| hearingStartDateInvalid: "Rhowch ddyddiad dechrau gwrandawiad dilys", | ||
| sensitivityRequired: "Dewiswch lefel sensitifrwydd", | ||
| languageRequired: "Dewiswch iaith", | ||
| displayFromRequired: "Rhowch ddyddiad dangos y ffeil o dilys", | ||
| displayFromInvalid: "Rhowch ddyddiad dangos y ffeil o dilys", | ||
| displayToRequired: "Rhowch ddyddiad dangos y ffeil tan dilys", | ||
| displayToInvalid: "Rhowch ddyddiad dangos y ffeil tan dilys", | ||
| displayToBeforeFrom: "Rhaid i'r dyddiad dangos tan fod ar ôl y dyddiad dangos o" | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It says here "Always upsert sub-jurisdictions. We only upserting regions and jurisdictions when tables are empty. What are we doing one but not others?