feat(arabot): add xp system

This commit is contained in:
smyalygames
2023-03-04 23:27:54 +00:00
parent 15f2f710a9
commit 80f38b2ca5
4 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE "Xp" (
"userId" TEXT NOT NULL,
"level" INTEGER NOT NULL DEFAULT 0,
"xp" INTEGER NOT NULL DEFAULT 0,
"messageCount" INTEGER NOT NULL DEFAULT 0,
"lastMessage" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Xp_pkey" PRIMARY KEY ("userId")
);
-- AddForeignKey
ALTER TABLE "Xp" ADD CONSTRAINT "Xp_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -37,6 +37,7 @@ model User {
muted Boolean @default(false)
VerifyUser Verify[] @relation("verUser")
VerifyVerifier Verify[] @relation("verVerifier")
Xp Xp?
Balance Balance?
Daily Daily[]
SendPayment Payment[] @relation("sendPayment")
@@ -94,6 +95,15 @@ model Verify {
notes String?
}
model Xp {
user User @relation(fields: [userId], references: [id])
userId String @id
level Int @default(0)
xp Int @default(0)
messageCount Int @default(0)
lastMessage DateTime @default(now())
}
// Economy
model Balance {