Skip to content

Modified auth interceptor and added a test on top - #961

Merged
tickBit merged 3 commits into
devfrom
955-bug-multiple-room-updates-all-at-once-doesnt-work
Sep 5, 2026
Merged

Modified auth interceptor and added a test on top#961
tickBit merged 3 commits into
devfrom
955-bug-multiple-room-updates-all-at-once-doesnt-work

Conversation

@CapoMK25

@CapoMK25 CapoMK25 commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Brief description

Issue #955

I added a test to check that the behavior doesn't repeat again on top of doing the changes to the file. The functionality in the authorization interceptor file is now split into two use cases: the single object logic that was present originally, and the array logic that's added as a new addition on top of that.

Change list

  • Updated AuthorizationInterceptor (src/authorization/authorization.interceptor.ts) to detect top-level array payloads (Array.isArray(request.body)) during UPDATE requests.

  • Refactored permission evaluation to iterate over array items individually with plainToInstance(), ensuring CASL checks permissions against individual DTO instances rather than the outer Array container type.

  • Applied lodash.pick() per item in array bodies to prevent field stripping and maintain correct array structure.

  • Preserved original single-object handling logic for standard non-array update payloads.

  • Added a new unit test suite (src/__tests__/authorization/authorizationInterceptor.array.test.ts) to provide testing coverage for top-level array updates passing through the authorization interceptor.

@codecov-alt

codecov-alt Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/authorization/authorization.interceptor.ts 87.50% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/authorization/authorization.interceptor.ts 72.47% <87.50%> (+52.88%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tickBit tickBit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Approved.

@github-project-automation github-project-automation Bot moved this from Backlog to Done in Altzone-Server Sep 5, 2026
@tickBit
tickBit merged commit 5da9a55 into dev Sep 5, 2026
5 checks passed
@tickBit
tickBit deleted the 955-bug-multiple-room-updates-all-at-once-doesnt-work branch September 5, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: Multiple room updates all at once doesn't work

2 participants