code refactoring + many security/bug fixes

This commit is contained in:
daniel31x13
2023-11-06 08:25:57 -05:00
parent b5a28f68ad
commit c8edc3844b
48 changed files with 472 additions and 317 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
import type { NextApiRequest, NextApiResponse } from "next";
import getCollections from "@/lib/api/controllers/collections/getCollections";
import postCollection from "@/lib/api/controllers/collections/postCollection";
import authenticateUser from "@/lib/api/authenticateUser";
import verifyUser from "@/lib/api/verifyUser";
export default async function collections(
req: NextApiRequest,
res: NextApiResponse
) {
const user = await authenticateUser({ req, res });
if (!user) return res.status(404).json({ response: "User not found." });
const user = await verifyUser({ req, res });
if (!user) return;
if (req.method === "GET") {
const collections = await getCollections(user.id);