Finished bulk delete links

This commit is contained in:
Isaac Wise
2024-02-10 00:37:48 -06:00
parent 193c66123b
commit ea31eb47ae
12 changed files with 195 additions and 20 deletions
+15
View File
@@ -0,0 +1,15 @@
import type { NextApiRequest, NextApiResponse } from "next";
import verifyUser from "@/lib/api/verifyUser";
import deleteLinksById from "@/lib/api/controllers/links/bulk/deleteLinksById";
export default async function links(req: NextApiRequest, res: NextApiResponse) {
const user = await verifyUser({ req, res });
if (!user) return;
if (req.method === "DELETE") {
const deleted = await deleteLinksById(user.id, req.body.linkIds);
return res.status(deleted.status).json({
response: deleted.response,
});
}
}