42 lines
1.3 KiB
TypeScript

import { PrismaClient } from '../../generated/prisma'
import { withAccelerate } from "@prisma/extension-accelerate"
import { type FastifyInstance, type FastifyReply, type FastifyRequest } from 'fastify'
import { env } from '../config/env'
import { constants } from '../config/constants'
import { isModerator, isAdmin } from '../utils/privs'
import type { pool }
// const prisma = new PrismaClient().$extends(withAccelerate())
async function indexRoutes(fastify: FastifyInstance): Promise<void> {
fastify.delete('/admin/queue', async function (request, reply) {
// const userId = request.session.get('userId')
// const user = await prisma.user.findUnique({
// where: { id: userId },
// include: {
// roles: true
// }
// })
// if (isAdmin(user)) {
// // @todo delete the queue
// // const pool = new Pool({
// // connectionString: process.env.DATABASE_URL,
// // });
// // const workerUtils = await WorkerUtils.make({ pgPool: pool });
// // await permanentlyFailAllJobs();
// // await workerUtils.release();
// // await pool.end();
// }
// return reply.viewAsync("admin.hbs", {
// user,
// site: constants.site
// });
})
}