Skip to content

Commit 4513e18

Browse files
Marfuenclaude
andcommitted
fix(vendors): skip assignee validation when assignee hasn't changed
The form sends the existing assigneeId on every PATCH even when the user only changed a different field (e.g. website). If the vendor's current assignee is a platform admin, every update fails with "Cannot assign a platform admin as assignee" — even though no one is trying to change the assignee. Only run validateAssigneeNotPlatformAdmin when assigneeId is actually being changed to a different value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 762d9b9 commit 4513e18

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/api/src/vendors/vendors.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,13 @@ export class VendorsService {
600600
) {
601601
try {
602602
// First check if the vendor exists in the organization
603-
await this.findById(id, organizationId);
603+
const existing = await this.findById(id, organizationId);
604604

605-
if (updateVendorDto.assigneeId) {
605+
// Only validate assignee when it's actually changing
606+
if (
607+
updateVendorDto.assigneeId &&
608+
updateVendorDto.assigneeId !== existing.assigneeId
609+
) {
606610
await this.validateAssigneeNotPlatformAdmin(updateVendorDto.assigneeId, organizationId);
607611
}
608612

0 commit comments

Comments
 (0)