#328 fx-adding input validations #602
Open
+694
−875
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.
PR Description
This PR addresses two key issues: duplication in mutation and types, and the lack of input validation in the application. The aim is to enhance the codebase by removing redundant mutations and types while ensuring robust input validation across relevant mutations.
Description of tasks that were expected to be completed
Remove Duplication in Mutations and Types
Consolidated redundant mutations and types, reducing unnecessary code duplication. This refactor improves maintainability and readability of the GraphQL schema.
Implement Input Validation
Added input validation to mutations where it was previously missing. This ensures that invalid data is caught early and appropriate error messages are returned. The validation checks for required fields, correct data formats, and constraints.
Refactor and Clean Code
Refactored the code to follow DRY (Don't Repeat Yourself) principles, ensuring that shared logic is reusable. Updated the documentation where necessary to reflect the changes.
How has this been tested?
Unit Tests
Unit tests were written for all affected mutations to ensure that the refactoring and validation implementation works as expected. Mock data and scenarios for invalid inputs were tested thoroughly.
Manual Testing
Manually tested the GraphQL API using tools like Postman and GraphQL Playground to ensure that valid inputs succeed and invalid inputs fail with proper error messages.
Regression Testing
Ran a full suite of regression tests to ensure that the refactor didn't introduce any new issues in unrelated parts of the application.
Number of Commits
The number of commits has been limited to 2 commits to ensure clarity:
Refactor and remove duplication.
Implement input validation and write tests.
Screenshots (If appropriate)
N/A
Please check this Checklist before you submit your PR:
My code follows the style guidelines of this project.
I have performed a self-review of my code.
I have commented my code, particularly in hard-to-understand areas.
My code generates no warnings.
My test coverage meets the set test coverage threshold.
There are no vulnerabilities.
There are no conflicts with the base branch.