Chaitanya - Purchase request form enhancement#2034
Open
csk731 wants to merge 2 commits intodevelopmentfrom
Open
Chaitanya - Purchase request form enhancement#2034csk731 wants to merge 2 commits intodevelopmentfrom
csk731 wants to merge 2 commits intodevelopmentfrom
Conversation
…Id, quantity, priority, and requestorId in bmMaterialsController.
…rove consistency in request body structure
Anusha-Gali
approved these changes
Feb 13, 2026
Anusha-Gali
left a comment
There was a problem hiding this comment.
Hi Chaitanya,
I have reviewed your PR locally and it works as expected. Find my comment in frontend pr: OneCommunityGlobal/HighestGoodNetworkApp#4814 (review)
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.
Description
Implements backend validation, error handling, and structured error responses for the Purchase Request APIs to align with the frontend validation, feedback, and confirmation flow. Validation covers required fields (project, material, quantity, priority), data types (ObjectIds, numeric quantity), and business rules (quantity > 0, valid priority). All validation errors return a consistent { field, message } structure so the frontend can show field-specific inline errors.
Related PRS (if any):
To test this backend PR you need to checkout the #4814 frontend PR.
Main changes explained:
Required fields: projectId, matTypeId, quantity, priority, requestorId. ObjectId checks for projectId, matTypeId, requestorId. Quantity: must be a valid number and > 0. Priority: must be Low, Medium, or High. All validation errors returned as { field, message } for field-specific frontend display 500 errors handled consistently
How to test: