Files
esign/packages/lib/server-only/document/get-recipient-or-sender-by-share-link-slug.ts
zooqueen fb4e3df0e3 rename: @hanzo/sign-* → @hanzo/esign-* (full eSign brand consistency)
The product is branded Hanzo eSign (esign.hanzo.ai, repo hanzoai/esign).
Rename all workspace packages @hanzo/sign-* → @hanzo/esign-* (1052 files)
and align docker/Dockerfile turbo --scope/--filter to the actual remix
package name @hanzo/esign (was a pre-existing mismatch with -remix that
broke the build). Protected deps (@hanzo/insights, @hanzo/logo) untouched.
2026-06-21 19:56:09 -07:00

50 lines
918 B
TypeScript

import { prisma } from '@hanzo/esign-prisma';
export type GetRecipientOrSenderByShareLinkSlugOptions = {
slug: string;
};
export const getRecipientOrSenderByShareLinkSlug = async ({
slug,
}: GetRecipientOrSenderByShareLinkSlugOptions) => {
const { envelopeId, email } = await prisma.documentShareLink.findFirstOrThrow({
where: {
slug,
},
});
const sender = await prisma.user.findFirst({
where: {
envelopes: { some: { id: envelopeId } },
email,
},
select: {
email: true,
name: true,
signature: true,
},
});
if (sender) {
return sender;
}
const recipient = await prisma.recipient.findFirst({
where: {
envelopeId,
email,
},
select: {
email: true,
name: true,
signatures: true,
},
});
if (recipient) {
return recipient;
}
throw new Error('Recipient or sender not found');
};