Admin dashboard for jobs

Extremely simple jobs dashboard to sanity-check what we've got going on in the job queue.
This commit is contained in:
Kyle Corbitt
2023-08-17 21:13:27 -07:00
parent 980644f13c
commit 94464c0617
12 changed files with 482 additions and 72 deletions

View File

@@ -10,6 +10,14 @@ await prisma.project.deleteMany({
where: { id: defaultId },
});
// Mark all users as admins
await prisma.user.updateMany({
where: {},
data: {
role: "ADMIN",
},
});
// If there's an existing project, just seed into it
const project =
(await prisma.project.findFirst({})) ??
@@ -18,12 +26,16 @@ const project =
}));
if (env.OPENPIPE_API_KEY) {
await prisma.apiKey.create({
data: {
await prisma.apiKey.upsert({
where: {
apiKey: env.OPENPIPE_API_KEY,
},
create: {
projectId: project.id,
name: "Default API Key",
apiKey: env.OPENPIPE_API_KEY,
},
update: {},
});
}