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
6 changes: 5 additions & 1 deletion apps/app/src/actions/organization/accept-invitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ export const completeInvitation = authActionClient
};
}

if (!invitation.role) {
throw new Error("Invitation role is required");
}

await db.member.create({
data: {
userId: user.id,
organizationId: invitation.organizationId,
role: invitation.role || "member",
role: invitation.role,
department: "none",
},
});
Expand Down
9 changes: 8 additions & 1 deletion apps/app/src/actions/organization/update-member-role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@ export const updateMemberRole = authActionClient
};
}

if (!role) {
throw new Error("Role is required");
}

// Convert role to a valid role type for the authClient
const validRole = role === "auditor" ? "member" : role;

await authClient.organization.updateMemberRole({
memberId: targetMember.userId,
role: role,
role: validRole as "owner" | "admin" | "member",
organizationId: ctx.session.activeOrganizationId ?? "",
});

Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/actions/risk/task/update-task-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const updateTaskAction = authActionClient
},
})
.action(async ({ parsedInput, ctx }) => {
const { id, dueDate, status, ownerId, title, description } = parsedInput;
const { id, dueDate, status, assigneeId, title, description } = parsedInput;
const { session } = ctx;

if (!session.activeOrganizationId) {
Expand All @@ -44,7 +44,7 @@ export const updateTaskAction = authActionClient
data: {
dueDate: dueDate,
status: status as TaskStatus,
userId: ownerId,
assigneeId: assigneeId,
title: title,
description: description,
},
Expand Down
Loading