mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
This PR is handles the changes required to support envelopes. The new envelope editor/signing page will be hidden during release. The core changes here is to migrate the documents and templates model to a centralized envelopes model. Even though Documents and Templates are removed, from the user perspective they will still exist as we remap envelopes to documents and templates.
38 lines
838 B
TypeScript
38 lines
838 B
TypeScript
import { EnvelopeType, SigningStatus } from '@prisma/client';
|
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
export type GetCompletedFieldsForTokenOptions = {
|
|
token: string;
|
|
};
|
|
|
|
// Note: You many need to filter this on a per envelope item ID basis.
|
|
export const getCompletedFieldsForToken = async ({ token }: GetCompletedFieldsForTokenOptions) => {
|
|
return await prisma.field.findMany({
|
|
where: {
|
|
envelope: {
|
|
type: EnvelopeType.DOCUMENT,
|
|
recipients: {
|
|
some: {
|
|
token,
|
|
},
|
|
},
|
|
},
|
|
recipient: {
|
|
signingStatus: SigningStatus.SIGNED,
|
|
},
|
|
inserted: true,
|
|
},
|
|
include: {
|
|
signature: true,
|
|
recipient: {
|
|
select: {
|
|
name: true,
|
|
email: true,
|
|
signingStatus: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|