mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 11:41:44 +10:00
document status, dashboard
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
export { sendSigningRequestMail } from "./sendSigningRequestMail";
|
||||
export { sendSigningRequest as sendSigningRequestMail } from "./sendSigningRequestMail";
|
||||
export { sendSignedMail } from "./sendSignedMail";
|
||||
|
||||
@ -1,8 +1,26 @@
|
||||
import prisma from "@documenso/prisma";
|
||||
import { sendMail } from "./sendMail";
|
||||
export const sendSigningRequestMail = async (recipient: any, document: any) => {
|
||||
import { SendStatus, DocumentStatus } from "@prisma/client";
|
||||
|
||||
export const sendSigningRequest = async (recipient: any, document: any) => {
|
||||
// todo errror handling
|
||||
await sendMail(
|
||||
recipient.email,
|
||||
`Please sign ${document.title}`,
|
||||
`${document.User.name} has sent you a document to sign. Click <b><a href="${process.env.NEXT_PUBLIC_WEBAPP_URL}/documents/${document.id}/sign">SIGN DOCUMENT</a></b> to sign it now.`
|
||||
);
|
||||
|
||||
await prisma.recipient.update({
|
||||
where: {
|
||||
id: recipient.id,
|
||||
},
|
||||
data: { sendStatus: SendStatus.SENT },
|
||||
});
|
||||
|
||||
await prisma.document.update({
|
||||
where: {
|
||||
id: document.id,
|
||||
},
|
||||
data: { status: DocumentStatus.PENDING },
|
||||
});
|
||||
};
|
||||
|
||||
@ -8,10 +8,11 @@ datasource db {
|
||||
}
|
||||
|
||||
model Document {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
title String
|
||||
status DocumentStatus @default(DRAFT)
|
||||
document String
|
||||
Recipient Recipient[]
|
||||
}
|
||||
@ -85,3 +86,9 @@ enum SigningStatus {
|
||||
NOT_SIGNED
|
||||
SIGNED
|
||||
}
|
||||
|
||||
enum DocumentStatus {
|
||||
DRAFT
|
||||
PENDING
|
||||
COMPLETED
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user