Skip to content

fix: Move admin routes before module.exports to register them properly#263

Merged
vedhapprakashni merged 2 commits intoAnushSingla:mainfrom
jayshinde0:fix/admin-routes-after-export
Mar 8, 2026
Merged

fix: Move admin routes before module.exports to register them properly#263
vedhapprakashni merged 2 commits intoAnushSingla:mainfrom
jayshinde0:fix/admin-routes-after-export

Conversation

@jayshinde0
Copy link
Copy Markdown
Contributor

🏟️ HuddleUp — Pull Request

📋 Description

Fixed critical bug where 6 admin routes (audit trail and cleanup management endpoints) were defined after module.exports = router, making them completely inaccessible. Moved all route definitions before the export statement.

🔗 Related Issue

Fixes #257

📝 Type of Change

  • 🐛 Bug Fix - Non-breaking fix for an issue

🏗️ Area of Change

  • server/ — Express backend (controllers, routes, middleware, models)

📸 Screenshots

N/A - Backend routing fix, no UI changes

✅ Checklist

For All PRs

  • I have read the CONTRIBUTING.md guidelines
  • I have tested my changes locally (both client and server if applicable)
  • My code follows the existing project structure and coding style
  • I have NOT modified any files unrelated to my change
  • No console errors or warnings introduced

For Backend Changes (server/)

  • API endpoints follow RESTful conventions
  • Auth middleware is applied where needed
  • Mongoose models/schema changes are backward-compatible
  • Error handling is implemented for new routes/controllers
  • Environment variables (if new) are documented

For Bug Fixes / Enhancements

  • My changes ONLY address the specific issue mentioned
  • I have NOT added any "bonus" features or unrelated changes
  • I properly tested the fix/enhancement

🧪 Testing

  • Backend API tested (Postman / Thunder Client / curl)
  • Auth flows work correctly (login, register, protected routes)
  • No console errors or server crashes

📝 Additional Notes

Routes now properly registered:

  • /api/admin/audit - Get audit trail
  • /api/admin/audit/export - Export audit logs
  • /api/admin/audit/stats - Get audit statistics
  • /api/admin/cleanup/trigger - Trigger cleanup
  • /api/admin/cleanup/stats - Get cleanup stats
  • /api/admin/cleanup/retention - Update retention period

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 8, 2026

@jayshinde0 is attempting to deploy a commit to the anushsingla's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 8, 2026

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@vedhapprakashni vedhapprakashni merged commit 7ce2f44 into AnushSingla:main Mar 8, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug:Admin Routes After module.exports Are Never Registered

2 participants