/
githubmirror
/
Open-Assistant
Обзор
Документация
Войти
/
githubmirror
/
Open-Assistant
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/src/pages/api/reject_task.ts
24 строки
787 B
Mekacher-Anis
Remove reason modal when skipping task (#1766)
20 фев 2023, 21:08
Не верифицирован
20 фев 2023, 21:08
afc0670
Код
Авторство
О чём код?
import { Prisma } from "@prisma/client"; import { withoutRole } from "src/lib/auth"; import { createApiClient } from "src/lib/oasst_client_factory"; import prisma from "src/lib/prismadb"; const handler = withoutRole("banned", async (req, res, token) => { // Parse out the local task ID and the interaction contents. const { id: frontendId } = req.body; const [oasstApiClient, registeredTask] = await Promise.all([ createApiClient(token), prisma.registeredTask.findUniqueOrThrow({ where: { id: frontendId } }), ]); const taskId = (registeredTask.task as Prisma.JsonObject).id as string; // Update the backend with the rejection await oasstApiClient.nackTask(taskId); // Send the results to the client. res.status(200).json({}); }); export default handler;