Skip to content

Restore Data Submission by File Upload#192

Open
joneubank wants to merge 8 commits intomainfrom
fix/restore-submit-files
Open

Restore Data Submission by File Upload#192
joneubank wants to merge 8 commits intomainfrom
fix/restore-submit-files

Conversation

@joneubank
Copy link
Contributor

@joneubank joneubank commented Feb 15, 2026

Summary

Restore data submission by file upload.

Important

This PR will require a major version release since it modifies API endpoint interfaces, and renames some of the exported properties of the submission service and controller.

Issues

Description of Changes

Data submission via file upload was removed in commit e24f7d6 , but it is desired behaviour. With these changes, the lyric server can now accept data submissions by file upload or by JSON in the request body through two separate endpoints.

A new endpoint was added to upload files for data submission.

The submission router has had the existing submit endpoint be moved to now include the entityName in the path, so this has become a "submit for single entity" endpoint. To match these changes, the edit submission endpoint was also moved to match the path of the submit for single entity. This follows the philosophy that required parameters should be in the path or body of the request instead of query parameters.

Data-Provider (Lyric npm library)

  • Submission Router
    • Updated path of existing submit and edit endpoints to move entity and organization into the path instead of being required query params.
    • Added new route for submitting data via file upload
  • File Utils
    • Restored file removed with original file upload implementation
  • Added Dependencies
    • Several libraries added to help with processing file uploads. Restored from original implementation.

Server

  • Config
    • New optional variable for submission max file size is added
    • Moved the utility functions to parse env values into their own file to focus config/app.ts on defining the AppConfig instead of process.env parsing.
  • env.schema
    • Included new optional env var for SUBMISSION_MAX_SIZE
    • Included default values so the app can startup connected to the included docker-compose.
    • Commented all optional env vars and left uncommented all required vars.
  • Swagger updates
    • New and changed routes documented
    • Updated several requests to reference shared parameter schema instead of redefining

Readiness Checklist

  • Self Review
    • I have performed a self review of code
    • I have run the application locally and manually tested the feature
    • I have checked all updates to correct typos and misspellings
  • Formatting
    • Code follows the project style guide
    • Autmated code formatters (ie. Prettier) have been run
  • Local Testing
    • Successfully built all packages locally
    • Successfully ran all test suites, all unit and integration tests pass
  • Updated Tests
    • Unit and integration tests have been added that describe the bug that was fixed or the features that were added
  • Documentation
    • All new environment variables added to .env.schema file and documented in the README
    • All changes to server HTTP endpoints have open-api documentation
    • All new functions exported from their module have TSDoc comment documentation

This work is based on the function that had been written and removed in commit: e24f7d6
This leaves the data provider with the existing submit functionality described as submitting single entity data. The new submit endpoint allows submitting files with filenames matching teh entity name.
@joneubank joneubank marked this pull request as ready for review February 15, 2026 21:25
Comment on lines +67 to +75
/**
* Processes a list of data records and compares them with previously submitted data.
* @param {DataRecord[]} records An array of data records to be processed
* @param {string} schemaName The name of the schema associated with the records
* @returns {Promise<SubmissionUpdateData[]>} An array of `SubmissionUpdateData` objects. Each object
* contains the `systemId`, `old` data, and `new` data representing the differences
* between the previously submitted data and the updated record.
*/
const compareUpdatedData = async (records: DataRecord[], schemaName: string): Promise<SubmissionUpdateData[]> => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved up file, sorting alphabetically.

Comment on lines +766 to +776
/**
* Update Active Submission in database
* @param {Object} input
* @param {number} input.dictionaryId The Dictionary ID of the Submission
* @param {SubmissionData} input.submissionData Data to be submitted grouped on inserts, updates and deletes
* @param {number} input.idActiveSubmission ID of the Active Submission
* @param {SubmissionErrors} input.schemaErrors Array of schemaErrors
* @param {string} input.username User updating the active submission
* @returns {Promise<number>} An Active Submission updated
*/
const updateActiveSubmission = async (input: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved down file. Large edits are from moving blocks of code around.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

File utilities restored from removed file upload code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Many interfaces and types renamed to match TitleCase standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant