feat: enhance member invite error handling and add invite more toggle (#133)

This commit is contained in:
Henry
2025-07-30 22:24:05 +01:00
committed by GitHub
parent 638b8b6b79
commit 400b94a5f2
22 changed files with 273 additions and 39 deletions

View File

@@ -56,7 +56,7 @@ export const memberRouter = createTRPCRouter({
if (isInvitedEmailAlreadyMember) {
throw new TRPCError({
message: `User with email ${input.email} is already a member of this workspace`,
code: "BAD_REQUEST",
code: "CONFLICT",
});
}
@@ -88,6 +88,12 @@ export const memberRouter = createTRPCRouter({
callbackURL: `/boards?type=invite&memberPublicId=${invite.publicId}`,
});
await memberRepo.softDelete(ctx.db, {
memberId: invite.id,
deletedAt: new Date(),
deletedBy: userId,
});
throw new TRPCError({
message: `Failed to send magic link invitation to user with email ${input.email}.`,
code: "INTERNAL_SERVER_ERROR",