Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: remove unused files (#27899)

Bobbie Soedirgo3d15e9d8f22c
diff --git a/apps/studio/pages/api/pg-meta/[ref]/functions.ts b/apps/studio/pages/api/pg-meta/[ref]/functions.ts
deleted file mode 100644
index 1fa68f55ee4..00000000000
--- a/apps/studio/pages/api/pg-meta/[ref]/functions.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { NextApiRequest, NextApiResponse } from 'next'
-import apiWrapper from 'lib/api/apiWrapper'
-import { constructHeaders, toSnakeCase } from 'lib/api/apiHelpers'
-import { PG_META_URL } from 'lib/constants'
-import { delete_, get, patch, post } from 'lib/common/fetch'
-
-export default (req: NextApiRequest, res: NextApiResponse) =>
- apiWrapper(req, res, handler, { withAuth: true })
-
-async function handler(req: NextApiRequest, res: NextApiResponse) {
- const { method } = req
-
- switch (method) {
- case 'GET':
- return handleGetAll(req, res)
- case 'POST':
- return handlePost(req, res)
- case 'PATCH':
- return handlePatch(req, res)
- case 'DELETE':
- return handleDelete(req, res)
- default:
- res.setHeader('Allow', ['GET', 'POST', 'PATCH', 'DELETE'])
- res.status(405).json({ error: { message: `Method ${method} Not Allowed` } })
- }
-}
-
-const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- let response = await get(`${PG_META_URL}/functions`, {
- headers,
- })
- if (response.error) {
- return res.status(400).json({ error: response.error })
- }
- return res.status(200).json(response)
-}
-
-const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const payload = toSnakeCase(req.body)
- const response = await post(`${PG_META_URL}/functions`, payload, {
- headers,
- })
-
- if (response.error) {
- console.error('Functions POST:', response.error)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
-
-const handlePatch = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const payload = toSnakeCase(req.body)
- const response = await patch(`${PG_META_URL}/functions/${req.query.id}`, payload, {
- headers,
- })
-
- if (response.error) {
- console.error('Functions PATCH:', response)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
-
-const handleDelete = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const response = await delete_(`${PG_META_URL}/functions/${req.query.id}`, {}, { headers })
-
- if (response.error) {
- console.error('Functions DELETE:', response.error)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
diff --git a/apps/studio/pages/api/pg-meta/[ref]/roles.ts b/apps/studio/pages/api/pg-meta/[ref]/roles.ts
deleted file mode 100644
index 4fa1c4c233e..00000000000
--- a/apps/studio/pages/api/pg-meta/[ref]/roles.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { NextApiRequest, NextApiResponse } from 'next'
-
-import apiWrapper from 'lib/api/apiWrapper'
-import { delete_, get, patch, post } from 'lib/common/fetch'
-import { constructHeaders } from 'lib/api/apiHelpers'
-import { PG_META_URL } from 'lib/constants'
-
-export default (req: NextApiRequest, res: NextApiResponse) =>
- apiWrapper(req, res, handler, { withAuth: true })
-
-async function handler(req: NextApiRequest, res: NextApiResponse) {
- const { method } = req
- switch (method) {
- case 'GET':
- return handleGetAll(req, res)
- case 'POST':
- return handlePost(req, res)
- case 'DELETE':
- return handleDelete(req, res)
- case 'PATCH':
- return handlePatch(req, res)
- default:
- res.setHeader('Allow', ['GET'])
- res.status(405).json({ error: { message: `Method ${method} Not Allowed` } })
- }
-}
-
-const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- let response = await get(`${PG_META_URL}/roles`, {
- headers,
- })
- if (response.error) {
- return res.status(400).json({ error: response.error })
- }
- return res.status(200).json(response)
-}
-
-const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const payload = req.body
- const response = await post(`${PG_META_URL}/roles`, payload, {
- headers,
- })
-
- if (response.error) {
- console.error('Role POST:', response.error)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
-
-const handleDelete = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const response = await delete_(`${PG_META_URL}/roles/${req.query.id}`, {}, { headers })
-
- if (response.error) {
- console.error('Role DELETE:', response.error)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
-
-const handlePatch = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const payload = req.body
- const response = await patch(`${PG_META_URL}/roles/${req.query.id}`, payload, {
- headers,
- })
-
- if (response.error) {
- console.error('Role PATCH:', response)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
diff --git a/apps/studio/pages/api/pg-meta/[ref]/schemas.ts b/apps/studio/pages/api/pg-meta/[ref]/schemas.ts
deleted file mode 100644
index 4f473efc42d..00000000000
--- a/apps/studio/pages/api/pg-meta/[ref]/schemas.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { NextApiRequest, NextApiResponse } from 'next'
-import apiWrapper from 'lib/api/apiWrapper'
-import { constructHeaders, toSnakeCase } from 'lib/api/apiHelpers'
-import { delete_, get, patch, post } from 'lib/common/fetch'
-import { PG_META_URL } from 'lib/constants'
-
-export default (req: NextApiRequest, res: NextApiResponse) =>
- apiWrapper(req, res, handler, { withAuth: true })
-
-async function handler(req: NextApiRequest, res: NextApiResponse) {
- const { method } = req
-
- switch (method) {
- case 'GET':
- return handleGetAll(req, res)
- case 'POST':
- return handlePost(req, res)
- case 'PATCH':
- return handlePatch(req, res)
- case 'DELETE':
- return handleDelete(req, res)
- default:
- res.setHeader('Allow', ['GET', 'POST', 'PATCH', 'DELETE'])
- res.status(405).json({ error: { message: `Method ${method} Not Allowed` } })
- }
-}
-
-const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- let response = await get(`${PG_META_URL}/schemas`, {
- headers,
- })
- if (response.error) {
- return res.status(400).json({ error: response.error })
- }
- return res.status(200).json(response)
-}
-
-const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const payload = toSnakeCase(req.body)
- const response = await post(`${PG_META_URL}/schemas`, payload, {
- headers,
- })
-
- if (response.error) {
- console.error('Column POST:', response.error)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
-
-const handlePatch = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const payload = toSnakeCase(req.body)
- const response = await patch(`${PG_META_URL}/schemas/${req.query.id}`, payload, {
- headers,
- })
-
- if (response.error) {
- console.error('Column PATCH:', response)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}
-
-const handleDelete = async (req: NextApiRequest, res: NextApiResponse) => {
- const headers = constructHeaders(req.headers)
- const response = await delete_(`${PG_META_URL}/schemas/${req.query.id}`, {}, { headers })
-
- if (response.error) {
- console.error('Column DELETE:', response.error)
- return res.status(400).json({ error: response.error })
- }
-
- return res.status(200).json(response)
-}