Skip to content

Architecture Inconsistency & Code Duplication (Feedback Logic) #623

Description

@OmBapodra

Bug Description

There is significant code duplication and architectural inconsistency regarding the Feedback feature. The Feedback Mongoose model and its corresponding route handlers (POST /api/feedback and GET /api/feedbacks) are defined directly inside the main server/index.js file. However, there are redundant files in server/src/models/feedback.model.js and server/src/controllers/feedback.controller.js that contain the exact same logic but are currently unused and disconnected from the main router.


Steps To Reproduce

  1. Open server/index.js.
  2. Observe the Feedback schema defined on line 93 and the inline routes for /api/feedback and /api/feedbacks.
  3. Navigate to server/src/models/feedback.model.js and server/src/controllers/feedback.controller.js.
  4. Observe that these files contain identical schemas and controller logic but are never imported or used.

Expected Behavior

The backend should follow a clean MVC architecture. The Feedback model in server/index.js should be moved to use server/src/models/feedback.model.js. The inline route handlers in server/index.js should be extracted into a dedicated server/src/routes/feedback.js file, which then uses the controllers from server/src/controllers/feedback.controller.js. The routes should then be mounted cleanly in index.js using app.use('/api/feedback', feedbackRoutes).


Actual Behavior

The code is duplicated. server/index.js handles the logic inline, leaving the structured MVC files in server/src entirely unused. This creates technical debt and makes the index.js file unnecessarily bloated.


Additional Context

Refactoring this will improve code efficiency, readability, and maintainability, aligning it with the pattern already used for auth and reports.

On the bases of my analysis i am able to interact with the issue and want to work on the issue so can you assign to @GSSOC'26 Contributor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions