Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/api/src/vendors/vendors.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,13 @@ export class VendorsService {
) {
try {
// First check if the vendor exists in the organization
await this.findById(id, organizationId);
const existing = await this.findById(id, organizationId);

if (updateVendorDto.assigneeId) {
// Only validate assignee when it's actually changing
if (
updateVendorDto.assigneeId &&
updateVendorDto.assigneeId !== existing.assigneeId
) {
await this.validateAssigneeNotPlatformAdmin(updateVendorDto.assigneeId, organizationId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ export const generateVendorMitigation = task({

await createVendorRiskComment(vendor, policies, organizationId, authorId);

// Mark vendor as assessed and assign to owner/admin
// Mark vendor as assessed and assign to author (unless they're a platform admin,
// since platform admins are hidden from the assignee UI and would block future updates)
const author = await db.member.findFirst({
where: { id: authorId, organizationId },
include: { user: { select: { role: true } } },
});
const assigneeId = author?.user.role === 'admin' ? null : authorId;

await db.vendor.update({
where: { id: vendor.id, organizationId },
data: {
status: VendorStatus.assessed,
assigneeId: authorId,
assigneeId,
},
});

Expand Down
Loading