singed mail template and fixes

This commit is contained in:
Timur Ercan
2023-01-30 17:33:03 +01:00
parent f532e7c738
commit 137c22962f
3 changed files with 44 additions and 8 deletions

View File

@ -5,7 +5,7 @@ import {
} from "@documenso/lib/server";
import prisma from "@documenso/prisma";
import { NextApiRequest, NextApiResponse } from "next";
import { sendSigningRequest } from "@documenso/lib/mail";
import { sendSignedMail, sendSigningRequest } from "@documenso/lib/mail";
import { SendStatus } from "@prisma/client";
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
@ -42,13 +42,14 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
const recipients = prisma.recipient.findMany({
where: {
documentId: +documentId,
sendStatus: SendStatus.NOT_SENT, // TODO REDO AFTER DEBUG
// sendStatus: SendStatus.NOT_SENT, // TODO REDO AFTER DEBUG
},
});
// todo check if recipient has an account and show them in their inbox or something
(await recipients).forEach(async (recipient) => {
await sendSigningRequest(recipient, document);
await sendSignedMail(recipient, document);
});
// todo way better error handling