Skip to content

#5154 - Ensure Application Creator is Set for Change Requests#5736

Merged
tiago-graf merged 13 commits intomainfrom
feature/#5154-set-application-creator
Feb 6, 2026
Merged

#5154 - Ensure Application Creator is Set for Change Requests#5736
tiago-graf merged 13 commits intomainfrom
feature/#5154-set-application-creator

Conversation

@tiago-graf
Copy link
Collaborator

@tiago-graf tiago-graf commented Feb 5, 2026

Summary

Sets the creator field for application change requests to the student's user ID. Includes migration to backfill existing NULL creators.

Addresses first AC of #5154.

image

@tiago-graf tiago-graf added E2E/Unit tests DB DB migration involved Backend Used by the dependabot pull requests to identify PRs related to the backend. labels Feb 5, 2026
@tiago-graf tiago-graf self-assigned this Feb 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses the first acceptance criterion of issue #5154 by ensuring the creator field is properly set for application change requests and enforcing NOT NULL constraints through a database migration.

Changes:

  • Sets the creator field to the student's user ID when creating application change requests
  • Adds a database migration to backfill NULL creator values with the student's user ID and enforce NOT NULL constraint
  • Updates test factories to properly set the creator field in test data
  • Adds e2e test assertions to verify the creator field is correctly populated

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sources/packages/backend/apps/api/src/services/application/application.service.ts Sets creator field for new application records in submitApplication and createApplicationChangeRequest methods, moving the assignment before the first save operation
sources/packages/backend/apps/db-migrations/src/migrations/1770252146185-SetApplicationCreatorFromStudentId.ts Migration class that applies SQL to backfill and enforce NOT NULL constraint on creator field
sources/packages/backend/apps/db-migrations/src/sql/Applications/Set-creator-from-student-id.sql SQL script to update NULL creators with student user IDs and add NOT NULL constraint
sources/packages/backend/apps/db-migrations/src/sql/Applications/Rollback-set-creator-from-student-id.sql Rollback script to revert NOT NULL constraint (contains critical bug)
sources/packages/backend/libs/test-utils/src/factories/application.ts Updates test factory to accept auditUser relation and use it to set the creator field in test data
sources/packages/backend/apps/api/src/route-controllers/application/tests/application.students.controller.applicationChangeRequest.e2e-spec.ts Adds assertions to verify creator field is properly set in e2e tests
.vscode/launch.json Adds new debug configuration for running tests by selected name (unrelated developer tooling)

tiago-graf and others added 2 commits February 5, 2026 15:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tiago-graf tiago-graf marked this pull request as ready for review February 5, 2026 23:34
],
"rootDir": ".",
"testRegex": ".*\\.spec\\.ts$",
"testRegex": ".*\\.(?:e2e-)?spec\\.ts$",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some discussion with @weskubo-cgi and some research we found out this seemed to be missing to enable the e2e tests in the test explorer, this now makes us able to see/run individual tests but i'm still wondering if you @dheepak-aot @andrewsignori-aot have ran into this before or if you use any other test tools to run the unit tests?

Image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config is used only for unit tests. If we are talking about the test explorer not being able to identify the e2e tests, I believe it is not considering the configs for e2e tests.
image

Let me know if I am missing something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the changes and made jest use the jest-e2e.json file by settings the jest command line to use the npm run test:e2e:api:local

"Sources",
"All",
],
"jest.jestCommandLine": "npm run test:e2e:api:local --",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 20.26% ( 4362 / 21535 )
Methods: 9.78% ( 257 / 2629 )
Lines: 24.41% ( 3739 / 15319 )
Branches: 10.2% ( 366 / 3587 )

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 75.41% ( 1055 / 1399 )
Methods: 79.31% ( 115 / 145 )
Lines: 78.79% ( 769 / 976 )
Branches: 61.51% ( 171 / 278 )

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 85.68% ( 1616 / 1886 )
Methods: 85% ( 187 / 220 )
Lines: 88.64% ( 1287 / 1452 )
Branches: 66.36% ( 142 / 214 )

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

E2E SIMS API Coverage Report

Totals Coverage
Statements: 77.55% ( 8918 / 11499 )
Methods: 77.05% ( 1054 / 1368 )
Lines: 81.62% ( 6473 / 7931 )
Branches: 63.23% ( 1391 / 2200 )

Copy link
Collaborator

@weskubo-cgi weskubo-cgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. And thanks for getting the Test Explorer setup. I love it.

Comment on lines +251 to +256
"jest.disabledWorkspaceFolders": [
"Web UI",
"Forms",
"DevOps",
"Load Tests",
"Sources",
Copy link
Collaborator

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.

Image

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes. Looks good 👍

@tiago-graf tiago-graf added this pull request to the merge queue Feb 6, 2026
Merged via the queue into main with commit c173fed Feb 6, 2026
22 checks passed
@tiago-graf tiago-graf deleted the feature/#5154-set-application-creator branch February 6, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Used by the dependabot pull requests to identify PRs related to the backend. DB DB migration involved E2E/Unit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants