sendLinkRequest: protectedProcedure
.input(z.object({
target_user_id: z.number(),
message: z.string().optional(),
}))
.mutation(async ({ ctx, input }) => {
...
// Send Novu notification
try {
await novu.trigger({
workflowId: 'account-link-request',
to: {
subscriberId: targetUser.clerk_id,
email: targetUser.email,
firstName: targetUser.firstname,
lastName: targetUser.lastname,
},
payload: {
requesterName: `${currentUser.firstname} ${currentUser.lastname}`,
requesterEmail: currentUser.email,
requesterType: currentUser.account_type,
targetType: targetUser.account_type,
message: input.message || '',
requestId: linkRequest[0]?.id,
actionUrl: `${env.NEXT_PUBLIC_BASE_URL}/settings?request=${linkRequest[0]?.id}`,
},
});
} catch (error) {
console.error('Failed to send notification:', error);
// Continue even if notification fails
}
sendLinkRequest: protectedProcedure
.input(z.object({
target_user_id: z.number(),
message: z.string().optional(),
}))
.mutation(async ({ ctx, input }) => {
...
// Send Novu notification
try {
await novu.trigger({
workflowId: 'account-link-request',
to: {
subscriberId: targetUser.clerk_id,
email: targetUser.email,
firstName: targetUser.firstname,
lastName: targetUser.lastname,
},
payload: {
requesterName: `${currentUser.firstname} ${currentUser.lastname}`,
requesterEmail: currentUser.email,
requesterType: currentUser.account_type,
targetType: targetUser.account_type,
message: input.message || '',
requestId: linkRequest[0]?.id,
actionUrl: `${env.NEXT_PUBLIC_BASE_URL}/settings?request=${linkRequest[0]?.id}`,
},
});
} catch (error) {
console.error('Failed to send notification:', error);
// Continue even if notification fails
}