04b7c41abf
refactor(prisma): update User model to include banned status and ban details refactor(prisma): modify Account model to include new authentication fields refactor(prisma): enhance Session model with impersonation tracking refactor(prisma): adjust Verification model to include value field feat(auth): integrate admin plugin and enhance email verification process refactor(category): enforce ownership checks in category service methods refactor(item): update item service to validate category ownership feat(item): add ability to fetch items by category refactor(restaurant): implement ownership checks and admin routes in restaurant controller fix(user): restrict user access to admin routes feat(exception): implement global exception filter for consistent error handling
122 lines
2.9 KiB
Plaintext
122 lines
2.9 KiB
Plaintext
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = "postgresql://postgres:root@localhost:5432/zemenu?schema=public"
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified Boolean @default(false)
|
|
image String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
// Relations
|
|
restaurants Restaurant[]
|
|
accounts Account[]
|
|
sessions Session[]
|
|
|
|
role String? @default("user")
|
|
banned Boolean? @default(false)
|
|
banReason String?
|
|
banExpires DateTime?
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
providerId String
|
|
provider String?
|
|
accountId String
|
|
password String?
|
|
accessToken String?
|
|
refreshToken String?
|
|
expiresAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
idToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
|
|
@@map("account")
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
expiresAt DateTime
|
|
token String? @unique
|
|
ipAddress String?
|
|
userAgent String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
impersonatedBy String?
|
|
|
|
@@map("session")
|
|
}
|
|
|
|
model Verification {
|
|
id String @id @default(cuid())
|
|
identifier String
|
|
token String?
|
|
expiresAt DateTime
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
value String
|
|
|
|
@@map("verification")
|
|
}
|
|
|
|
model Restaurant {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique // used as /domain.com/slug
|
|
description String?
|
|
logo String? // image URL
|
|
ownerId String
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
|
|
template String?
|
|
|
|
categories Category[]
|
|
items MenuItem[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(uuid())
|
|
name String
|
|
|
|
restaurantId String
|
|
restaurant Restaurant @relation(fields: [restaurantId], references: [id])
|
|
|
|
items MenuItem[]
|
|
}
|
|
|
|
model MenuItem {
|
|
id String @id @default(uuid())
|
|
name String
|
|
description String?
|
|
price Float
|
|
image String?
|
|
|
|
categoryId String?
|
|
category Category? @relation(fields: [categoryId], references: [id])
|
|
|
|
restaurantId String
|
|
restaurant Restaurant @relation(fields: [restaurantId], references: [id])
|
|
|
|
createdAt DateTime @default(now())
|
|
}
|