mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
32 lines
628 B
TypeScript
32 lines
628 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
export interface GetDocumentAndSenderByTokenOptions {
|
|
token: string;
|
|
}
|
|
|
|
export const getDocumentAndSenderByToken = async ({
|
|
token,
|
|
}: GetDocumentAndSenderByTokenOptions) => {
|
|
const result = await prisma.document.findFirstOrThrow({
|
|
where: {
|
|
Recipient: {
|
|
some: {
|
|
token,
|
|
},
|
|
},
|
|
},
|
|
include: {
|
|
User: true,
|
|
documentData: true,
|
|
},
|
|
});
|
|
|
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
const { password: _password, ...User } = result.User;
|
|
|
|
return {
|
|
...result,
|
|
User,
|
|
};
|
|
};
|