Files
tabungin/apps/api/dist/seed.js
2025-10-09 12:52:41 +07:00

37 lines
982 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const client_1 = require("@prisma/client");
const prisma = new client_1.PrismaClient();
async function main() {
const userId = '16b74848-daa3-4dc9-8de2-3cf59e08f8e3';
const user = await prisma.user.upsert({
where: { id: userId },
update: {},
create: {
id: userId,
},
});
const existing = await prisma.wallet.findFirst({
where: { userId: user.id, kind: 'money' },
});
if (!existing) {
await prisma.wallet.create({
data: {
userId: user.id,
kind: 'money',
name: 'Cash',
currency: 'IDR',
},
});
}
console.log('Seed complete. TEMP_USER_ID=', user.id);
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});
//# sourceMappingURL=seed.js.map