-
Notifications
You must be signed in to change notification settings - Fork 13
#5154 - Ensure Application Creator is Set for Change Requests #5736
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
a6f5d5a
9ce787a
1f02ec9
81d2345
7674537
b135196
895ea73
6795e4d
d5c5fa8
fd68e13
3f6f52f
a2e4895
b7c3709
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,32 +2,32 @@ | |
| "folders": [ | ||
| { | ||
| "name": "Web UI", | ||
| "path": "./sources/packages/web" | ||
| "path": "./sources/packages/web", | ||
| }, | ||
| { | ||
| "name": "Backend", | ||
| "path": "./sources/packages/backend" | ||
| "path": "./sources/packages/backend", | ||
| }, | ||
| { | ||
| "name": "Forms", | ||
| "path": "./sources/packages/forms" | ||
| "path": "./sources/packages/forms", | ||
| }, | ||
| { | ||
| "name": "DevOps", | ||
| "path": "./devops" | ||
| "path": "./devops", | ||
| }, | ||
| { | ||
| "name": "Load Tests", | ||
| "path": "./sources/packages/load-test" | ||
| "path": "./sources/packages/load-test", | ||
| }, | ||
| { | ||
| "name": "Sources", | ||
| "path": "./sources" | ||
| "path": "./sources", | ||
| }, | ||
| { | ||
| "name": "All", | ||
| "path": "." | ||
| } | ||
| "path": ".", | ||
| }, | ||
| ], | ||
| "extensions": { | ||
| "recommendations": [ | ||
|
|
@@ -40,8 +40,9 @@ | |
| "adpyke.vscode-sql-formatter", | ||
| "redhat.vscode-yaml", | ||
| "mongodb.mongodb-vscode", | ||
| "sonarsource.sonarlint-vscode" | ||
| ] | ||
| "sonarsource.sonarlint-vscode", | ||
| "orta.vscode-jest", | ||
| ], | ||
| }, | ||
| "tasks": { | ||
| "version": "2.0.0", | ||
|
|
@@ -51,91 +52,91 @@ | |
| "type": "shell", | ||
| "command": "make deploy-camunda-definitions", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Sources}" | ||
| "cwd": "${workspaceFolder:Sources}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "Deploy Form Definitions", | ||
| "type": "shell", | ||
| "command": "make deploy-form-definitions", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Sources}" | ||
| "cwd": "${workspaceFolder:Sources}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "Database - Run Migrations", | ||
| "type": "shell", | ||
| "command": "npm run migration:run", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Backend}" | ||
| "cwd": "${workspaceFolder:Backend}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "Database - Clean E2E Test DB", | ||
| "type": "shell", | ||
| "command": "npm run db:seed:test:clean", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Backend}" | ||
| "cwd": "${workspaceFolder:Backend}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "Database - Reset for API E2E Tests", | ||
| "type": "shell", | ||
| "command": "npm run db:seed:test:clean && npm run test:e2e:api:seed", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Backend}" | ||
| "cwd": "${workspaceFolder:Backend}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "Database - Reset for Queue-consumers E2E Tests", | ||
| "type": "shell", | ||
| "command": "npm run db:seed:test:clean && npm run test:e2e:queue-consumers:seed", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Backend}" | ||
| "cwd": "${workspaceFolder:Backend}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "View Outdated Web Packages", | ||
| "type": "shell", | ||
| "command": "npm outdated", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Web UI}" | ||
| "cwd": "${workspaceFolder:Web UI}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "View Outdated Backend Packages", | ||
| "type": "shell", | ||
| "command": "npm outdated", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Backend}" | ||
| "cwd": "${workspaceFolder:Backend}", | ||
| }, | ||
| "problemMatcher": [] | ||
| "problemMatcher": [], | ||
| }, | ||
| { | ||
| "label": "View Outdated Forms Packages", | ||
| "type": "shell", | ||
| "command": "npm outdated", | ||
| "options": { | ||
| "cwd": "${workspaceFolder:Forms}" | ||
| "cwd": "${workspaceFolder:Forms}", | ||
| }, | ||
| "problemMatcher": [] | ||
| } | ||
| ] | ||
| "problemMatcher": [], | ||
| }, | ||
| ], | ||
| }, | ||
| "settings": { | ||
| "eslint.workingDirectories": [{ "mode": "auto" }], | ||
| "search.exclude": { | ||
| "**/bin": true, | ||
| "**/obj": true, | ||
| "**/dist": true, | ||
| "**/node_modules": true | ||
| "**/node_modules": true, | ||
| }, | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||
| "editor.formatOnSave": true, | ||
|
|
@@ -145,8 +146,8 @@ | |
| "editor.codeActionsOnSave": { | ||
| "source.addMissingImports": "explicit", | ||
| "source.fixAll.eslint": "explicit", | ||
| "source.removeUnusedImports": "always" | ||
| } | ||
| "source.removeUnusedImports": "always", | ||
| }, | ||
| }, | ||
| "typescript.preferences.importModuleSpecifier": "non-relative", | ||
| "cSpell.words": [ | ||
|
|
@@ -238,14 +239,23 @@ | |
| "unparse", | ||
| "VALD", | ||
| "WTHD", | ||
| "Zeebe" | ||
| "Zeebe", | ||
| ], | ||
| "[json]": { | ||
| "editor.defaultFormatter": "vscode.json-language-features" | ||
| "editor.defaultFormatter": "vscode.json-language-features", | ||
| }, | ||
| "[sql]": { | ||
| "editor.defaultFormatter": "adpyke.vscode-sql-formatter" | ||
| "editor.defaultFormatter": "adpyke.vscode-sql-formatter", | ||
| }, | ||
| "sql-formatter.uppercase": true | ||
| } | ||
| "sql-formatter.uppercase": true, | ||
| "jest.disabledWorkspaceFolders": [ | ||
| "Web UI", | ||
| "Forms", | ||
| "DevOps", | ||
| "Load Tests", | ||
| "Sources", | ||
| "All", | ||
| ], | ||
| "jest.jestCommandLine": "npm run test:e2e:api:local --", | ||
|
Collaborator
Author
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. this makes the text explorer recognize the e2e tests now, the draw back is that the unit tests are not present (we would need a combined config file if that was necessary)
Collaborator
Author
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. not sure why the whole file formatting changed, i'm assuming no one touched this file in a while |
||
| }, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { MigrationInterface, QueryRunner } from "typeorm"; | ||
| import { getSQLFileData } from "../utilities/sqlLoader"; | ||
|
|
||
| /** | ||
| * Migration to set the creator field for applications using the mapped user ID from the student ID. | ||
| * This ensures all applications have a non-null creator field that references the student who created/submitted them. | ||
| * This addresses the first acceptance criterion of ticket #5154. | ||
| */ | ||
| export class SetApplicationCreatorFromStudentId1770252146185 implements MigrationInterface { | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| getSQLFileData("Set-creator-from-student-id.sql", "Applications"), | ||
| ); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| getSQLFileData( | ||
| "Rollback-set-creator-from-student-id.sql", | ||
| "Applications", | ||
| ), | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /* | ||
| Since there is no way to know the records that were affected by the migration we are leaving the creator field as is and only rolling back | ||
| the alter column to allow nulls. | ||
| */ | ||
| -- Rollback the creator field to allow NULLs again. | ||
| ALTER TABLE | ||
| sims.applications | ||
| ALTER COLUMN | ||
| creator DROP NOT NULL; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| -- Set the creator field for applications using the mapped user ID from the student ID. | ||
| -- This migration handles application change requests and other applications that were created with a NULL creator. | ||
| -- The creator is set to the student's user ID from the student table. | ||
| UPDATE | ||
| sims.applications | ||
| SET | ||
| creator = s.user_id | ||
| FROM | ||
| sims.students s | ||
| WHERE | ||
| sims.applications.student_id = s.id | ||
| AND sims.applications.creator IS NULL; | ||
dheepak-aot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| -- Alter the creator field to NOT NULL after setting the values. | ||
| ALTER TABLE | ||
| sims.applications | ||
| ALTER COLUMN | ||
| creator | ||
| SET | ||
| NOT NULL; | ||
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.
The tool looks great. Thanks.