Skip to content

refactor: move product validation logic to dedicated middleware#251

Merged
BHUVANSH855 merged 1 commit into
AnthropicBots:mainfrom
jikrana1:feat/product-validator-middleware-243
Jun 23, 2026
Merged

refactor: move product validation logic to dedicated middleware#251
BHUVANSH855 merged 1 commit into
AnthropicBots:mainfrom
jikrana1:feat/product-validator-middleware-243

Conversation

@jikrana1

Copy link
Copy Markdown

📋 Pull Request — Extract Product Validation into Dedicated Middleware

🔗 Related Issue

Closes #243


📝 Summary

Refactored product validation logic by moving request validation out of the routes file into a dedicated middleware module. This improves code organization, readability, and maintainability.

✨ Changes Made

  • Created a separate productValidator.js middleware file.
  • Moved create product validation logic into validateCreateProduct.
  • Moved update product validation logic into validateUpdateProduct.
  • Updated product routes to use the new validation middleware.
  • Reduced clutter in the routes file and improved separation of concerns.
  • Kept validation behavior unchanged while making the codebase more modular.

🎯 Benefits

  • Cleaner and more maintainable route definitions.
  • Better separation of responsibilities.
  • Easier to extend and reuse validation logic in the future.
  • Improved overall project structure and readability.

🧪 Tested

  • ✅ Create Product API
  • ✅ Update Product API
  • ✅ Validation error responses
  • ✅ Route functionality remains unchanged

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Bhuvansh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@BHUVANSH855 BHUVANSH855 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@BHUVANSH855 BHUVANSH855 added action: merge Pull Request is ready for merge. SSoC26 Program label for Social Summer of Code Season 5. Hard Program's points label. labels Jun 23, 2026
@BHUVANSH855 BHUVANSH855 merged commit 195c1a9 into AnthropicBots:main Jun 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge Pull Request is ready for merge. Hard Program's points label. SSoC26 Program label for Social Summer of Code Season 5.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Refactor inline validation logic from productRoutes.js into controller or dedicated validator middleware

2 participants