Implemented server routes

This commit is contained in:
Sebastian Seedorf
2022-08-17 23:27:19 +02:00
parent 9660f0cf34
commit 92b762bbd2
27 changed files with 2754 additions and 1692 deletions

15
pages/api/dev/schemas.ts Normal file
View File

@@ -0,0 +1,15 @@
import {GroupData, setGroups} from "../../../src/database/groups";
import {NetworkError, nextHandler} from "../../../src/utils/errors";
import getConfig from "next/config";
import {addSchemas, waitForInitSchemas} from "../../../src/validation/schemas";
const {publicRuntimeConfig: {TENANT_TYPE}} = getConfig()
const handler = nextHandler(async (req, res) => {
if (req.method !== 'GET') throw new NetworkError('Invalid method')
if (TENANT_TYPE !== 'local') throw new NetworkError('Not allowed', undefined, 400)
await waitForInitSchemas.resolve()
res.json({ success: true })
})
export default handler