Files
2025-05-28 09:55:51 +08:00

1050 lines
25 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
password String
role Role @default(USER)
isEmailVerified Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Token Token[]
}
model Token {
id Int @id @default(autoincrement())
token String
type TokenType
expires DateTime
blacklisted Boolean
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
userId Int
memberId Int?
}
enum Role {
USER
ADMIN
}
enum TokenType {
ACCESS
REFRESH
RESET_PASSWORD
VERIFY_EMAIL
}
// REQ0044/near_by_page
model Member {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
email String @unique
name String?
Event Event[]
eventId Int?
age Int?
rank String @default("Beginner")
verified String @default("NOT_VERIFIED")
hobbies String[] @default([])
distance String @default("10km")
location_area String @default("Sai Kung")
greetings String @default("Hi, I am")
gender String @default("not disclosed")
tall_cm Int?
weight_kg Int?
occupation String @default("not disclosed")
language String[] @default([])
education String[] @default([])
self_introduction String @default("")
music String[] @default([])
pets String[] @default([])
character String[] @default([])
}
// REQ0042/event-detail
model Event {
id Int @id @default(autoincrement())
eventDate DateTime
title String
joinMembers Member[] // Assuming Member model exists
price Float
currency String
duration_m Int
ageBottom Int
ageTop Int
location String
avatar String // Assuming avatar is stored as a file path or URL
Order Order[]
}
model Order {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
title String?
order_time DateTime @default(now())
last_payment_date DateTime?
status String @default("pending")
Event Event[]
}
// cms_backend
// mapped to IProductReview
model ProductReview {
id Int @id @default(autoincrement())
name String
rating Float
comment String
helpful Float
avatarUrl String
postedAt DateTime @default(now()) // Assuming IDateValue maps to DateTime
isPurchased Boolean
attachments String[]
ProductItem ProductItem[]
//
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// mapped to IProductFilters
model ProductFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
rating String
gender String[]
category String
colors String[]
priceRange Int[]
}
// mapped to IProductTableFilters
model ProductTableFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
stock String[]
publish String[]
}
// mapped to IProductItem
model ProductItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
sku String
name String
code String
price Float
taxes Float
tags String[]
sizes String[]
publish String
gender String[]
coverUrl String
images String[]
colors String[]
quantity Int
category String
available Int
totalSold Int
description String
totalRatings Float
totalReviews Int
inventoryType String
subDescription String
priceSale Float?
newLabel Json
saleLabel Json
ratings Json[]
reviews ProductReview[]
testing Helloworld[]
}
//
model Helloworld {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
hello String @default("")
ProductItem ProductItem[]
}
model MailSender {
// Define fields for MailSender here
// Example:
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
email String
name String
avatarUrl String?
//
// SendMail Mail[] @relation("mail_from")
// ReceiveMail Mail[] @relation("mail_to")
}
model MailLabel {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
type String
name String
color String
unreadCount Int?
}
model MailAttachment {
// Define fields for MailAttachment here
// Example:
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
filename String
url String
size Int
// Mail Mail? @relation(fields: [mailId], references: [id])
// mailId Int?
}
model Mail {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
folder String
labelIds String[]
subject String
isUnread Boolean
isImportant Boolean
message String
isStarred Boolean
//
// from MailSender @relation("mail_from", fields: [mailFromId], references: [id])
// mailFromId Int
//
// to MailSender[] @relation("mail_to")
//
// attachments MailAttachment[]
}
model OrderHistory {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
orderTime DateTime
paymentTime DateTime
deliveryTime DateTime
completionTime DateTime
timeline Json[]
OrderItem OrderItem? @relation(fields: [orderItemId], references: [id])
orderItemId Int?
}
model OrderShippingAddress {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
fullAddress String
phoneNumber String
OrderItem OrderItem? @relation(fields: [orderItemId], references: [id])
orderItemId Int?
}
model OrderPayment {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
cardType String
cardNumber String
OrderItem OrderItem? @relation(fields: [orderItemId], references: [id])
orderItemId Int?
}
model OrderDelivery {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
shipBy String
speedy String
trackingNumber String
OrderItem OrderItem? @relation(fields: [orderItemId], references: [id])
orderItemId Int?
}
model OrderCustomer {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
email String
avatarUrl String
ipAddress String
OrderItem OrderItem? @relation(fields: [orderItemId], references: [id])
orderItemId Int?
}
model OrderProductItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
sku String
name String
price Float
coverUrl String
quantity Float
OrderItem OrderItem? @relation(fields: [orderItemId], references: [id])
orderItemId Int?
}
model OrderItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
taxes Float
status String
shipping Float
discount Float
subtotal Float
orderNumber String
totalAmount Float
totalQuantity Float
history OrderHistory[]
payment OrderPayment[]
customer OrderCustomer[]
delivery OrderDelivery[]
items OrderProductItem[]
shippingAddress OrderShippingAddress[]
}
// src/types/tour.ts
model TourGuide {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
avatarUrl String
phoneNumber String
TourItem TourItem? @relation(fields: [tourItemId], references: [id])
tourItemId Int?
TourFilters TourFilters? @relation(fields: [tourFiltersId], references: [id])
tourFiltersId Int?
}
model TourBooker {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
guests Float
avatarUrl String
TourItem TourItem? @relation(fields: [tourItemId], references: [id])
tourItemId Int?
}
model TourItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
price Float
tags String[]
content String
publish String
images String[]
durations String
priceSale Float
totalViews Float
services String[]
destination String
ratingNumber Float
bookers TourBooker[]
tourGuides TourGuide[]
available Json
}
model TourFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
services String[]
destination String[]
tourGuides TourGuide[]
endDate DateTime
startDate DateTime
}
// src/types/user.ts
model UserProfileCover {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
role String
coverUrl String
avatarUrl String
}
model UserProfile {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
role String
quote String
email String
school String
country String
company String
totalFollowers Float
totalFollowing Float
// socialLinks: ISocialLink
}
model UserProfileFollower {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
country String
avatarUrl String
}
model UserProfileGallery {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
title String
imageUrl String
postedAt DateTime
}
model UserProfileFriend {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
role String
avatarUrl String
}
model UserProfilePost {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
media String
message String
personLikes Json[]
comments Json[]
}
model UserCard {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
role String
coverUrl String
avatarUrl String
totalPosts Float
totalFollowers Float
totalFollowing Float
}
model UserItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
city String
role String
email String
state String
status String
address String
country String
zipCode String
company String
avatarUrl String
phoneNumber String
isVerified Boolean
}
model UserAccountBillingHistory {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
price Float
invoiceNumber String
}
// src/types/blog.ts
model PostFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
publish String
}
model PostHero {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
title String
coverUrl String
author Json?
}
model PostComment {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
message String
avatarUrl String
postedAt DateTime
users Json[]
replyComment Json[]
PostItem PostItem? @relation(fields: [postItemId], references: [id])
postItemId Int?
}
model PostItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
title String
tags String[]
publish String
content String
coverUrl String
metaTitle String
totalViews Float
totalShares Float
description String
totalComments Float
totalFavorites Float
metaKeywords String[]
metaDescription String
comments PostComment[]
author Json
favoritePerson Json[]
}
// src/types/calendar.ts
model CalendarFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
colors String[]
startDate DateTime
endDate DateTime
}
model CalendarRange {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
start String?
end String?
}
model CalendarEvent {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
color String
title String
allDay Boolean
description String
end String
start String
}
// src/types/chat.ts
model ChatAttachment {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
size Int
type String
path String
preview String
ChatMessage ChatMessage? @relation(fields: [chatMessageId], references: [id])
chatMessageId Int?
}
model ChatMessage {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
body String
senderId String
contentType String
attachments ChatAttachment[]
ChatConversation ChatConversation? @relation(fields: [chatConversationId], references: [id])
chatConversationId Int?
}
model ChatParticipant {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
role String
email String
address String
avatarUrl String
phoneNumber String
lastActivity DateTime
status String
ChatConversation ChatConversation? @relation(fields: [chatConversationId], references: [id])
chatConversationId Int?
}
model ChatConversation {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
type String
unreadCount Int
messages ChatMessage[]
participants ChatParticipant[]
}
model ChatConversations {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
allIds String[]
byId Json
}
// src/types/checkout.ts
model CheckoutItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
size String
price Float
coverUrl String
colors String[]
quantity Float
available Float
subtotal Float
CheckoutState CheckoutState? @relation(fields: [checkoutStateId], references: [id])
checkoutStateId Int?
}
model CheckoutDeliveryOption {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
label String
value Float
description String
}
model CheckoutPaymentOption {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
value String
label String
description String
}
model CheckoutCardOption {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
value String
label String
}
model CheckoutState {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
total Float
subtotal Float
discount Float
shipping Float
totalItems Float
items CheckoutItem[]
billing AddressItem[]
}
// common.ts
model PaymentCard {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
cardType String
primary Boolean?
cardNumber String
}
model AddressItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
company String?
primary Boolean?
fullAddress String
phoneNumber String?
addressType String?
CheckoutState CheckoutState[]
checkoutStateId Int?
InvoiceTo Invoice[] @relation("invoice_to")
InvoiceFrom Invoice[] @relation("invoice_from")
}
model SocialLink {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
twitter String
facebook String
linkedin String
instagram String
}
// file.ts
model FileFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
type String[]
endDate DateTime
startDate DateTime
}
model FileShared {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
email String
avatarUrl String
permission String
FolderManager FolderManager? @relation(fields: [folderManagerId], references: [id])
folderManagerId Int?
FileManager FileManager? @relation(fields: [fileManagerId], references: [id])
fileManagerId Int?
}
model FolderManager {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
url String
name String
size Int
type String
tags String[]
totalFiles Int?
isFavorited Boolean
modifiedAt DateTime
shared FileShared[]
}
model FileManager {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
url String
name String
size Int
type String
tags String[]
isFavorited Boolean
modifiedAt DateTime
shared FileShared[]
}
model FileStore {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
modifiedAt DateTime @updatedAt
//
name String
path String
preview String
size Float
type String
}
// invoice.ts
model InvoiceTableFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
status String
service String[]
endDate DateTime
startDate DateTime
}
model InvoiceItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
title String
price Float
total Float
service String
quantity Int
description String
Invoice Invoice? @relation(fields: [invoiceId], references: [id])
invoiceId Int?
}
model Invoice {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
sent Int
taxes Float
status String
subtotal Float
discount Float
shipping Float
totalAmount Float
dueDate DateTime
invoiceNumber String
items InvoiceItem[]
createDate DateTime
invoiceTo AddressItem[] @relation("invoice_to")
invoiceFrom AddressItem[] @relation("invoice_from")
}
// job.ts
model JobFilters {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
roles String[]
experience String
benefits String[]
locations String[]
employmentTypes String[]
}
model JobCandidate {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
role String
avatarUrl String
JobItem JobItem[]
}
model JobCompany {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
logo String
phoneNumber String
fullAddress String
JobItem JobItem[]
}
model JobSalary {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
type String
price Float
negotiable Boolean
JobItem JobItem[]
}
model JobItem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
role String
title String
content String
publish String
skills String[]
totalViews Float
experience String
benefits String[]
locations String[]
employmentTypes String[]
workingSchedule String[]
expiredDate DateTime? @db.Timestamp(3)
salary JobSalary[]
company JobCompany[]
candidates JobCandidate[]
}
// kanban.ts
model KanbanColumn {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
Kanban Kanban? @relation(fields: [kanbanId], references: [id])
kanbanId Int?
}
model KanbanComment {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
message String
avatarUrl String
messageType String
KanbanTask KanbanTask? @relation(fields: [kanbanTaskId], references: [id])
kanbanTaskId Int?
}
model KanbanAssignee {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
role String
email String
status String
address String
avatarUrl String
phoneNumber String
lastActivity DateTime
KanbanTask KanbanTask? @relation(fields: [kanbanTaskId], references: [id])
kanbanTaskId Int?
}
model Reporter {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
avatarUrl String
KanbanTask KanbanTask? @relation(fields: [kanbanTaskId], references: [id])
kanbanTaskId Int?
}
model KanbanTask {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
name String
status String
priority String
labels String[]
description String?
attachments String[]
comments KanbanComment[]
assignee KanbanAssignee[]
due DateTime[]
reporter Reporter[]
Kanban Kanban? @relation(fields: [kanbanId], references: [id])
kanbanId Int?
}
model Kanban {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
//
columns KanbanColumn[]
tasks KanbanTask[]
}