Skip to content

Commit ac8b676

Browse files
authored
Merge pull request #2376 from trycompai/main
[comp] Production Deploy
2 parents f02d785 + 9e508c2 commit ac8b676

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
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

apps/app/src/trigger/tasks/onboarding/generate-vendor-mitigation.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,19 @@ export const generateVendorMitigation = task({
4444

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

47-
// Mark vendor as assessed and assign to owner/admin
47+
// Mark vendor as assessed and assign to author (unless they're a platform admin,
48+
// since platform admins are hidden from the assignee UI and would block future updates)
49+
const author = await db.member.findFirst({
50+
where: { id: authorId, organizationId },
51+
include: { user: { select: { role: true } } },
52+
});
53+
const assigneeId = author?.user.role === 'admin' ? null : authorId;
54+
4855
await db.vendor.update({
4956
where: { id: vendor.id, organizationId },
5057
data: {
5158
status: VendorStatus.assessed,
52-
assigneeId: authorId,
59+
assigneeId,
5360
},
5461
});
5562

0 commit comments

Comments
 (0)