From 46a509a996d1607139641dd3ced19771aeaeee64 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Mon, 27 May 2024 17:28:04 +0200 Subject: [PATCH] Add an API page for run-lints endpoint. --- .../pages/api/projects/[ref]/run-lints.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 apps/studio/pages/api/projects/[ref]/run-lints.ts diff --git a/apps/studio/pages/api/projects/[ref]/run-lints.ts b/apps/studio/pages/api/projects/[ref]/run-lints.ts new file mode 100644 index 00000000000..91c1e8d3ec2 --- /dev/null +++ b/apps/studio/pages/api/projects/[ref]/run-lints.ts @@ -0,0 +1,24 @@ +import { NextApiRequest, NextApiResponse } from 'next' + +import apiWrapper from 'lib/api/apiWrapper' +import { extractResponse } from 'pages/api/constants' + +export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) + +async function handler(req: NextApiRequest, res: NextApiResponse) { + const { method } = req + + switch (method) { + case 'GET': + return handleGet(req, res) + default: + res.setHeader('Allow', ['GET']) + res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } }) + } +} + +type ResponseData = extractResponse<'/platform/projects/{ref}/run-lints', 'get'> + +const handleGet = async (req: NextApiRequest, res: NextApiResponse) => { + return res.status(200).json([]) +}