#171: Refactor Submission Record data access layer for new schema - #209
Open
leoraba wants to merge 20 commits into
Open
#171: Refactor Submission Record data access layer for new schema#209leoraba wants to merge 20 commits into
leoraba wants to merge 20 commits into
Conversation
leoraba
marked this pull request as draft
July 3, 2026 16:07
…n_records_refactor
…n_records_refactor
leoraba
force-pushed
the
feat/submission_records_refactor
branch
from
August 11, 2026 11:53
b62e41b to
4a94d8f
Compare
updated tsdocs, removed unused code, added missing db transactions
leoraba
force-pushed
the
feat/submission_records_refactor
branch
from
August 11, 2026 17:57
b5fcdc6 to
5679af7
Compare
leoraba
marked this pull request as ready for review
August 14, 2026 13:35
leoraba
commented
Aug 14, 2026
| $ref: '#/components/responses/ServiceUnavailableError' | ||
|
|
||
| /submission/{submissionId}/{actionType}: | ||
| /submission/{submissionId}/data: |
Contributor
Author
There was a problem hiding this comment.
renamed this endpoint to /data and changed to query params to include recordId and fileId
leoraba
commented
Aug 14, 2026
| /submission/{submissionId}/details: | ||
| get: | ||
| summary: Fetch Submission Data records. Sorted in their original file order and grouped by `inserts`, `updates`, and `deletes`. | ||
| summary: Fetch Submission Data records. Sorted in their original file order and grouped by `insert`, `update`, and `delete`. |
Contributor
Author
There was a problem hiding this comment.
Changed the values of this query param to be consistent through all the application
leoraba
commented
Aug 14, 2026
Comment on lines
+1
to
+2
| ALTER TABLE "submissions" DROP COLUMN IF EXISTS "data";--> statement-breakpoint | ||
| ALTER TABLE "submissions" DROP COLUMN IF EXISTS "errors"; No newline at end of file |
Contributor
Author
There was a problem hiding this comment.
removing data and errors column from submission table, this PR assumes the SQL script migration (0016) moved all submissions data into it's own separate table
leoraba
commented
Aug 14, 2026
Comment on lines
+797
to
+800
| await Promise.all( | ||
| Object.entries(insertRecords).map(([entityName, entityRecords]) => | ||
| dependencies.db.transaction(async (tx) => { | ||
| const savedFileId = await submissionFilesRepository.save( |
Contributor
Author
There was a problem hiding this comment.
wrapped in a db transaction storing each file along with it's records for atomicity.
…n_records_refactor
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Refactors the functions responsible for fetching, updating, and deleting, and validate Submission Records to align with the new database structure.
Issues
This PR is part 2 of #171
depends on PR #206
Description of Changes
dataanderrorsin Submission table. NOTE: This permanently deletes the data and errors values stored under the old schema. This data has already been migrated to the new schema, so no information is lost.GET /submission/category/{categoryId}/details:to/submission/category/{categoryId}/data:added query paramfileIdDELETE /submission/category/{categoryId}/{actionType}:to/submission/category/{categoryId}/data:added query params:fileId,recordIdReadiness Checklist
.env.schemafile and documented in the README