Skip to content

Commit

Permalink
Correct retrieval of document context in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Baalmart committed Nov 27, 2024
1 parent 7250029 commit 800e166
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/auth-service/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ UserSchema.pre(
try {
// Helper function to handle role updates
const handleRoleUpdates = async (fieldName, idField) => {
const query = this.getQuery ? this.getQuery() : this;
const query = this.getQuery ? this.getQuery() : { _id: this._id };
const doc = await this.model.findOne(query);

Check warning on line 260 in src/auth-service/models/User.js

View check run for this annotation

Codecov / codecov/patch

src/auth-service/models/User.js#L260

Added line #L260 was not covered by tests
if (!doc) return;

Expand Down

0 comments on commit 800e166

Please sign in to comment.