feat: implement FormSubmission and FormSubmissionVersionsRouter with … #8
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.
This pull request introduces a significant refactor and enhancement to the data capture module, specifically separating the handling of form submissions and their versions. It introduces new routers and response models, updates tests to match the new structure, and adds comprehensive test data for both form submissions and submission versions. The changes improve clarity, maintainability, and test coverage for the form submission and versioning APIs.
API Refactor and Enhancements
FormSubmissionVersionsRouterclass to manage creation and retrieval of form submission versions, separating this responsibility from the existingFormSubmissionsRouter. This includes methods for creating a version, fetching all versions for a submission, and retrieving a single version.FormSubmissionsRouterto remove version creation logic and focus solely on retrieving paginated lists of form submissions, now properly hydrating relationships such as contributors, creator, form, organisation, and versions.Model and Data Structure Updates
FormSubmissionresponse model with metadata and relationships to contributors, creator, form, organisation, and versions, supporting better hydration and type safety.Testing Improvements
FormSubmissionVersionsRouter, covering creation, retrieval of all versions, and retrieval of a single version, using new test fixtures.FormSubmissionsRouterTestto reflect the new API structure, focusing on retrieval and hydration of submissions rather than creation. [1] [2]Test Data and Fixtures
These changes collectively improve the separation of concerns for form submissions and their versions, enhance the API's clarity, and provide a solid foundation for future features and maintenance.…pagination support