refactored public page endpoints

This commit is contained in:
daniel31x13
2023-11-15 13:12:06 -05:00
parent 09ee81bf11
commit 59815f47d8
18 changed files with 262 additions and 128 deletions
+20
View File
@@ -0,0 +1,20 @@
import getPublicCollection from "@/lib/api/controllers/public/collections/getPublicCollection";
import type { NextApiRequest, NextApiResponse } from "next";
export default async function collections(
req: NextApiRequest,
res: NextApiResponse
) {
if (!req?.query?.id) {
return res
.status(401)
.json({ response: "Please choose a valid collection." });
}
if (req.method === "GET") {
const collection = await getPublicCollection(Number(req?.query?.id));
return res
.status(collection.status)
.json({ response: collection.response });
}
}