15 lines
455 B
TypeScript
15 lines
455 B
TypeScript
import {GroupData, setGroups} from "../../src/database/groups";
|
|
import {nextHandler} from "../../src/utils/errors";
|
|
import {waitForInitSchemas} from "../../src/validation/schemas";
|
|
|
|
const handler = nextHandler(async (req, res) => {
|
|
if (req.method !== 'POST') throw new Error('Invalid method')
|
|
await waitForInitSchemas.resolve()
|
|
const data = req.body as GroupData
|
|
|
|
const uuid = await setGroups(data)
|
|
res.json({ uuid })
|
|
})
|
|
|
|
export default handler
|