321 lines
9.5 KiB
Plaintext
321 lines
9.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["debian-openssl-1.1.x", "windows", "darwin-arm64"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "mysql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
steamName String @db.LongText
|
|
steamID String @unique
|
|
email String? @unique
|
|
steamAvatar String @db.LongText
|
|
mainBalance Int
|
|
bonusBalance Int @default(0)
|
|
firstDateAuth DateTime @default(now())
|
|
lvl Int @default(1)
|
|
experience Int @default(0)
|
|
sumOfDeposits Int @default(0)
|
|
sumOfRefunds Int @default(0)
|
|
discordLink String? @db.LongText
|
|
VKLink String? @db.LongText
|
|
TGLink String? @db.LongText
|
|
createdAt DateTime @default(now())
|
|
lastActivity DateTime?
|
|
role USER_ROLE @default(CLIENT)
|
|
Inventory Inventory[]
|
|
Orders Orders[]
|
|
Purchase Purchase[]
|
|
Tokens Token[]
|
|
Transaction Transaction[]
|
|
TransfersReceiver Transfers[] @relation("receiver")
|
|
TransfersSender Transfers[] @relation("sender")
|
|
UserGifts UserGifts[]
|
|
}
|
|
|
|
model Transaction {
|
|
id Int @id @default(autoincrement())
|
|
userId Int?
|
|
method String @db.LongText
|
|
amount Int
|
|
createdAt DateTime @default(now())
|
|
status EStatusOfRefill @default(FALSE)
|
|
sendNotification Boolean @default(false)
|
|
pointAmount Int @default(0)
|
|
paymentId String? @db.VarChar(255)
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
@@index([userId], map: "Transaction_userId_fkey")
|
|
}
|
|
|
|
model Purchase {
|
|
id Int @id @default(autoincrement())
|
|
userId Int?
|
|
amount Int
|
|
createdAt DateTime @default(now())
|
|
lostMainBalance Int
|
|
lostBonusBalance Int
|
|
refund Boolean
|
|
productId Int
|
|
dateOfPurchase String?
|
|
Inventory Inventory[]
|
|
product Product @relation(fields: [productId], references: [id])
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
@@index([productId], map: "Purchase_productId_fkey")
|
|
@@index([userId], map: "Purchase_userId_fkey")
|
|
}
|
|
|
|
model Transfers {
|
|
id Int @id @default(autoincrement())
|
|
senderId Int
|
|
receiverId Int
|
|
amount Int
|
|
createdAt DateTime @default(now())
|
|
receiver User @relation("receiver", fields: [receiverId], references: [id])
|
|
sender User @relation("sender", fields: [senderId], references: [id])
|
|
|
|
@@index([receiverId], map: "Transfers_receiverId_fkey")
|
|
@@index([senderId], map: "Transfers_senderId_fkey")
|
|
}
|
|
|
|
model Inventory {
|
|
id Int @id @default(autoincrement())
|
|
amount Int
|
|
status EStatusOfProductInInventory @default(INVENTORY)
|
|
dateOfReceive DateTime?
|
|
historyOfPurchaseId Int?
|
|
userId Int
|
|
serverTypeId Int?
|
|
serverId Int?
|
|
serverName String? @db.LongText
|
|
productId Int
|
|
createdAt DateTime @default(now())
|
|
isCanBeRefund Boolean @default(true)
|
|
isPartOfPack Boolean?
|
|
packId Int?
|
|
purchase Purchase? @relation(fields: [historyOfPurchaseId], references: [id], onDelete: Restrict)
|
|
product Product @relation(fields: [productId], references: [id])
|
|
server Server? @relation(fields: [serverId], references: [id])
|
|
serverType ServerType? @relation(fields: [serverTypeId], references: [id])
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
@@index([historyOfPurchaseId], map: "Inventory_historyOfPurchaseId_fkey")
|
|
@@index([productId], map: "Inventory_productId_fkey")
|
|
@@index([serverId], map: "Inventory_serverId_fkey")
|
|
@@index([serverTypeId], map: "Inventory_serverTypeId_fkey")
|
|
@@index([userId], map: "Inventory_userId_fkey")
|
|
}
|
|
|
|
model ServerType {
|
|
id Int @id @default(autoincrement())
|
|
name String @db.LongText
|
|
description String @db.LongText
|
|
number Int
|
|
hidden Boolean @default(true)
|
|
Inventory Inventory[]
|
|
Product Product[]
|
|
Server Server[]
|
|
}
|
|
|
|
model Server {
|
|
id Int @id @default(autoincrement())
|
|
serverTypeId Int
|
|
IP String @db.LongText
|
|
port String @db.LongText
|
|
apiKey String @db.LongText
|
|
name String @default("SERVER")
|
|
serverID Int
|
|
Inventory Inventory[]
|
|
typeOfSever ServerType @relation(fields: [serverTypeId], references: [id])
|
|
|
|
@@index([serverTypeId], map: "Server_serverTypeId_fkey")
|
|
}
|
|
|
|
model Product {
|
|
id Int @id @default(autoincrement())
|
|
name_ru String @db.LongText
|
|
description_ru String? @db.LongText
|
|
image String? @db.LongText
|
|
type ETypeOfProduct @default(GAME_ITEM)
|
|
productContent Json?
|
|
serverTypeId Int?
|
|
amount Int @default(1)
|
|
isChangeAmount Boolean @default(false)
|
|
price Int
|
|
discount Int? @default(1)
|
|
saleDiscount Int? @default(1)
|
|
saleDeadline DateTime?
|
|
maxCountOfSale Int?
|
|
hidden Boolean @default(true)
|
|
number Int?
|
|
autoactivation Boolean @default(false)
|
|
blockSize Int @default(1)
|
|
isBackgroundImage Boolean @default(false)
|
|
nameID String?
|
|
buttonColor EButtonColor @default(BLUE)
|
|
height Int?
|
|
iconButton String?
|
|
textButton String?
|
|
isBackgroundColor Boolean @default(false)
|
|
description_en String? @db.LongText
|
|
name_en String @db.LongText
|
|
textButton_en String?
|
|
isGift Boolean? @default(false)
|
|
lvl Int?
|
|
iconUrl String? @db.VarChar(255)
|
|
Inventory Inventory[]
|
|
serverType ServerType? @relation(fields: [serverTypeId], references: [id])
|
|
Purchase Purchase[]
|
|
|
|
@@index([serverTypeId], map: "Product_serverTypeId_fkey")
|
|
}
|
|
|
|
model Promocodes {
|
|
id Int @id @default(autoincrement())
|
|
name String @db.LongText
|
|
countOfActivation Int
|
|
createdAt DateTime @default(now())
|
|
startDate DateTime
|
|
endDate DateTime
|
|
discountAmount Int?
|
|
depositBonus Int?
|
|
plusBonusBalance Int?
|
|
limitActivation Int
|
|
groupId String @default(uuid()) @db.LongText
|
|
itemSet String? @db.LongText
|
|
}
|
|
|
|
model BaseSettings {
|
|
id Int @id @default(autoincrement())
|
|
header String @db.LongText
|
|
saleMode Boolean @default(false)
|
|
startBalance Int
|
|
mainPage String @db.LongText
|
|
apiKey String @db.LongText
|
|
IPWhiteList String @db.LongText
|
|
panelURLs Json?
|
|
}
|
|
|
|
model UrlSettings {
|
|
id Int @id @default(autoincrement())
|
|
icon String? @db.LongText
|
|
text String? @db.LongText
|
|
typeUrl ETypeOfURL @default(CUSTOM_PAGE)
|
|
url String @db.LongText
|
|
hidden Boolean @default(true)
|
|
sections Json?
|
|
isHaveSidebar Boolean?
|
|
}
|
|
|
|
model Token {
|
|
id Int @id @default(autoincrement())
|
|
token String @db.LongText
|
|
userId Int
|
|
browser String?
|
|
clientIp String?
|
|
deviceName String?
|
|
deviceType String?
|
|
os String?
|
|
User User @relation(fields: [userId], references: [id])
|
|
|
|
@@index([userId], map: "Token_userId_fkey")
|
|
}
|
|
|
|
model Contacts {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
url String
|
|
icon String
|
|
}
|
|
|
|
model Visitors {
|
|
id Int @id @default(autoincrement())
|
|
ip String
|
|
createdAt DateTime @default(now())
|
|
sortDate String
|
|
sortedMonth String
|
|
}
|
|
|
|
model Orders {
|
|
id Int @id @default(autoincrement())
|
|
userId Int?
|
|
createdAt DateTime @default(now())
|
|
status String @default("PENDING") @db.VarChar(255)
|
|
balance Int? @default(0)
|
|
user User? @relation(fields: [userId], references: [id])
|
|
|
|
@@index([userId], map: "Orders_userId_fkey")
|
|
}
|
|
|
|
model Gifts {
|
|
id Int @id @default(autoincrement())
|
|
lvl Int
|
|
iconUrl String? @db.VarChar(255)
|
|
name String @db.VarChar(255)
|
|
type Gifts_type
|
|
UserGifts UserGifts[]
|
|
}
|
|
|
|
model UserGifts {
|
|
userId Int
|
|
giftId Int
|
|
amount Int? @default(0)
|
|
User User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "UserGifts_ibfk_1")
|
|
Gifts Gifts @relation(fields: [giftId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "UserGifts_ibfk_2")
|
|
|
|
@@id([userId, giftId])
|
|
@@index([giftId], map: "giftId")
|
|
}
|
|
|
|
enum USER_ROLE {
|
|
CLIENT
|
|
ADMINISTRATOR
|
|
}
|
|
|
|
enum EStatusOfRefill {
|
|
SUCCESS
|
|
FALSE
|
|
DENIED
|
|
REFUND
|
|
IN_PROGRESS
|
|
}
|
|
|
|
enum EStatusOfProductInInventory {
|
|
INVENTORY
|
|
ON_SERVER
|
|
}
|
|
|
|
enum ETypeOfProduct {
|
|
GAME_ITEM
|
|
SERVICE
|
|
SETS_OF_PRODUCTS
|
|
HTTP_REQUEST
|
|
CURRENCY
|
|
CARDS
|
|
}
|
|
|
|
enum ETypeOfURL {
|
|
SITE_SECTION
|
|
CUSTOM_PAGE
|
|
EXTERNAL_LINK
|
|
DROPDOWN_LIST
|
|
}
|
|
|
|
enum EButtonColor {
|
|
GREEN
|
|
BLUE
|
|
}
|
|
|
|
enum Gifts_type {
|
|
item
|
|
product
|
|
service
|
|
privilege
|
|
set
|
|
}
|