Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { PrismaClient } from '@prisma/client';
import { faker } from '@faker-js/faker';
const db = new PrismaClient();

const userId = faker.number.int({ min: 5, max: 10 });
const main = async () => {
const orderData = [...Array(10)].map(() => ({
id: faker.number.int({ min: 10, max: 170 }),
total: faker.number.float({ min: 7, max: 15657, precision: 0.01 }),
createdAt: faker.date.anytime(),
updatedAt: faker.date.anytime(),
userId: 5,
userId: userId,
stripeInvoiceId: faker.string.alphanumeric(15),
}));

Expand All @@ -22,7 +23,7 @@ const main = async () => {

await db.user.create({
data: {
id: faker.number.int({ min: 5, max: 10 }),
id: userId,
name: faker.person.fullName(),
address: faker.location.streetAddress(),
email: faker.internet.email(),
Expand Down Expand Up @@ -50,6 +51,7 @@ const main = async () => {
createdAt: order.createdAt,
updatedAt: order.updatedAt,
userId: order.userId,
stripeInvoiceId: order.stripeInvoiceId
},
});
});
Expand Down