mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-29 22:58:18 -05:00
closes #276
This commit is contained in:
30
prisma/scripts/preBuild.ts
Normal file
30
prisma/scripts/preBuild.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import prisma from "../client";
|
||||
|
||||
const main = async () => {
|
||||
const patrons = await prisma.user.findMany({
|
||||
where: { patreonTier: { not: null } },
|
||||
orderBy: { patreonTier: "desc" },
|
||||
select: {
|
||||
username: true,
|
||||
discriminator: true,
|
||||
patreonTier: true,
|
||||
discordId: true,
|
||||
},
|
||||
});
|
||||
|
||||
fs.writeFile(
|
||||
path.resolve(__dirname, "..", "..", "utils", "data", "patrons.json"),
|
||||
JSON.stringify(patrons),
|
||||
function (err) {
|
||||
if (err) throw err;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
main()
|
||||
.catch((e) => console.error(e))
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user