mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
sign endpoint stub
This commit is contained in:
@ -1 +1,35 @@
|
|||||||
export {};
|
import {
|
||||||
|
defaultHandler,
|
||||||
|
defaultResponder,
|
||||||
|
getUserFromToken,
|
||||||
|
} from "@documenso/lib/server";
|
||||||
|
import prisma from "@documenso/prisma";
|
||||||
|
import { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
|
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const user = getUserFromToken(req, res);
|
||||||
|
const { id: documentId } = req.query;
|
||||||
|
if (!user) return;
|
||||||
|
|
||||||
|
if (!documentId) {
|
||||||
|
res.status(400).send("Missing parameter documentId.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let document = await prisma.document.findFirst({
|
||||||
|
where: {
|
||||||
|
id: +documentId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!document)
|
||||||
|
res.status(404).end(`No document with id ${documentId} found.`);
|
||||||
|
|
||||||
|
// todo sign stuff
|
||||||
|
|
||||||
|
res.status(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defaultHandler({
|
||||||
|
POST: Promise.resolve({ default: defaultResponder(postHandler) }),
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user