diff --git a/prisma/schema.prisma b/prisma/schema.prisma index cdf4892..73704c5 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -15,4 +15,22 @@ model User { password String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt +} + +model Item { + id String @id @default(cuid()) @map("_id") + name String + price Float + quantity Int @default(0) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt +} + +model Cart { + id String @id @default(cuid()) @map("_id") + userId String + itemId String + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + @@unique([userId, itemId]) } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 8395060..5858de5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,36 +10,3 @@ const prisma = new PrismaClient({ } } }); - -async function createUser(firstName, lastName, email, password) { - console.log('Creating user...') - const user = await prisma.user.create({ - data: { - firstName, - lastName, - email, - password, - }, - }); - console.log(`Created user with id: ${user.id}`) - console.log('User created!'); - return user; -} - -createUser('John', 'Doe', 'john@example.com', 'password') - .then((user) => { - console.log('User created:', user); - }) - .catch((error) => { - console.error('Error creating user:', error); - }) - .finally(() => { - prisma.$disconnect(); - }); - - - - - - -