first commit
This commit is contained in:
37
apps/api/dist/seed.js
vendored
Normal file
37
apps/api/dist/seed.js
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"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
|
||||
Reference in New Issue
Block a user