Skip to content

fix: let /assign auto-assign without a department - #230

Merged
Janani-bn merged 1 commit into
Janani-bn:mainfrom
saisarans2007:fix/assign-allow-auto-assign
Nov 15, 2026
Merged

Janani-bn merged 1 commit into
Janani-bn:mainfrom
saisarans2007:fix/assign-allow-auto-assign

Conversation

@saisarans2007

Copy link
Copy Markdown
Contributor

Summary

assignComplaint supports autoAssign: true, which picks the department from the complaint's issue type. But validateDepartmentAssignment ran first and returned 400 whenever department was missing, so that branch was unreachable.

The validator now lets the request through when autoAssign === true. Manual assignment still requires a department, and a non-boolean autoAssign like "yes" still gets validated.

Tests

Added backend/tests/departmentAssignment.test.js:

  • auto-assign without a department passes the validator. This fails on main.
  • a missing department without auto-assign is still 400
  • a non-boolean autoAssign doesn't bypass the check

npm test in backend: 85 passed.

Fixes #229

assignComplaint routes a complaint by issue type when autoAssign is true,
but validateDepartmentAssignment rejected any request without a department
first, so auto-assign could never be reached.
@Janani-bn
Janani-bn merged commit b7ce27b into Janani-bn:main Nov 15, 2026
3 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.

C:/Program Files/Git/api/assign rejects autoAssign requests, so auto-assignment never runs

2 participants