🚑 hotfix: seeding system

This commit is contained in:
Rafi Arrafif
2026-01-29 02:40:25 +07:00
parent e305d955f1
commit 5bfb376e88
5 changed files with 77 additions and 39 deletions

View File

@ -1,4 +1,5 @@
import { generateUUIDv7 } from "../../src/helpers/databases/uuidv7";
import { createFile } from "../../src/helpers/files/createFile";
import { prisma } from "../../src/utils/databases/prisma/connection";
export const userSystemSeed = async () => {
@ -12,10 +13,20 @@ export const userSystemSeed = async () => {
"$2a$12$ynOrzVCvRdejGp/7KJW4lOAwRzFYhSHDE.Dp3Fqh3sXAq1BIwfwc6",
};
return await prisma.user.upsert({
const insertedUserSystem = await prisma.user.upsert({
where: { username: payload.username },
update: {},
create: payload,
select: { id: true },
});
await createFile(
`export const SystemAccountId = "${insertedUserSystem.id}";`,
{
fileName: "system.ts",
targetDir: "src/config/account",
overwriteIfExists: true,
},
);
return insertedUserSystem;
};