fix: add auth session lifetime

This commit is contained in:
David Nguyen
2025-02-19 18:04:36 +11:00
parent 24f3ecd94f
commit ac30654913
12 changed files with 29 additions and 130 deletions

View File

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