feat: successfully protected all endpoints with next-api-middleware for verifyApiKey
This commit is contained in:
1 parent
752a61c756
commit
ec8fe36930
8 files changed
+167
-89
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
import { User } from "@calcom/prisma/client";
|
||||
import withMiddleware from "@lib/helpers/withMiddleware";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
type ResponseData = {
|
||||
@@ -8,8 +9,9 @@ type ResponseData = {
|
||||
error?: unknown;
|
||||
};
|
||||
|
||||
export default async function user(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
|
||||
async function user(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
|
||||
const data = await prisma.user.findMany();
|
||||
if (data) res.status(200).json({ data });
|
||||
else res.status(400).json({ error: "No data found" });
|
||||
}
|
||||
export default withMiddleware("addRequestId")(user);
|
||||
Reference in new issue
Block a user