Skip to content

Conversation

@Akalanka47000
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Nov 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
bashaway-backend Ignored Ignored Nov 29, 2025 1:01pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds database-level auditing functionality to track changes made to the User, Submission, and Question models. The implementation uses the @sliit-foss/mongoose-audit plugin with express-http-context to capture the user making each change.

  • Added audit plugin integration to User, Submission, and Question schemas
  • Modified repository methods to ensure audit hooks are triggered properly
  • Set up context middleware to track the authenticated user for audit logging

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/helpers/audit.js Created audit helper that configures the mongoose-audit plugin with user context retrieval
src/models/user.js Added audit plugin to User schema
src/models/submission.js Added audit plugin to Submission schema
src/models/question.js Added audit plugin to Question schema
src/middleware/auth.js Set authenticated user in express-http-context for audit tracking
src/repository/submission.js Changed from Submission.create() to new Submission().save() to trigger audit hooks
src/repository/question/index.js Changed from Question.deleteOne() to Question.findOneAndDelete() for audit trail
src/constants/index.js Added ctxUser constant for context key
src/app.js Removed unused pick import from lodash
package.json Added @sliit-foss/mongoose-audit dependency and packageManager field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Akalanka47000 Akalanka47000 merged commit 8c3741c into main Nov 29, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants