mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
36 lines
716 B
TypeScript
36 lines
716 B
TypeScript
import { SigningStatus } from '@prisma/client';
|
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
export type GetCompletedFieldsForTokenOptions = {
|
|
token: string;
|
|
};
|
|
|
|
export const getCompletedFieldsForToken = async ({ token }: GetCompletedFieldsForTokenOptions) => {
|
|
return await prisma.field.findMany({
|
|
where: {
|
|
document: {
|
|
recipients: {
|
|
some: {
|
|
token,
|
|
},
|
|
},
|
|
},
|
|
recipient: {
|
|
signingStatus: SigningStatus.SIGNED,
|
|
},
|
|
inserted: true,
|
|
},
|
|
include: {
|
|
signature: true,
|
|
recipient: {
|
|
select: {
|
|
name: true,
|
|
email: true,
|
|
signingStatus: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|