mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
34 lines
693 B
TypeScript
34 lines
693 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
import { SigningStatus } from '@documenso/prisma/client';
|
|
|
|
export type GetCompletedFieldsForTokenOptions = {
|
|
token: string;
|
|
};
|
|
|
|
export const getCompletedFieldsForToken = async ({ token }: GetCompletedFieldsForTokenOptions) => {
|
|
return await prisma.field.findMany({
|
|
where: {
|
|
Document: {
|
|
Recipient: {
|
|
some: {
|
|
token,
|
|
},
|
|
},
|
|
},
|
|
Recipient: {
|
|
signingStatus: SigningStatus.SIGNED,
|
|
},
|
|
inserted: true,
|
|
},
|
|
include: {
|
|
Signature: true,
|
|
Recipient: {
|
|
select: {
|
|
name: true,
|
|
email: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|