lang-database 16.1.0 → 17.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `subscriptionExpire` on the `users` table. All the data in the column will be lost.
5
+ - Added the required column `dailyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
6
+ - Added the required column `monthlyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
7
+ - Added the required column `weeklyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
8
+
9
+ */
10
+ -- AlterTable
11
+ ALTER TABLE "userStats" ADD COLUMN "dailyGoalAchieved" BOOLEAN NOT NULL,
12
+ ADD COLUMN "monthlyGoalAchieved" BOOLEAN NOT NULL,
13
+ ADD COLUMN "weeklyGoalAchieved" BOOLEAN NOT NULL;
14
+
15
+ -- AlterTable
16
+ ALTER TABLE "users" DROP COLUMN "subscriptionExpire";
@@ -0,0 +1,15 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "BadgeReason" AS ENUM ('WeeklyGoal', 'MonthlyGoal', 'ManyCardsDone');
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "badges" (
6
+ "id" TEXT NOT NULL,
7
+ "userId" TEXT NOT NULL,
8
+ "type" "BadgeReason" NOT NULL,
9
+ "timestamp" TIMESTAMP(3) NOT NULL,
10
+
11
+ CONSTRAINT "badges_pkey" PRIMARY KEY ("id")
12
+ );
13
+
14
+ -- AddForeignKey
15
+ ALTER TABLE "badges" ADD CONSTRAINT "badges_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,3 +1,3 @@
1
1
  # Please do not edit this file manually
2
- # It should be added in your version-control system (i.e. Git)
3
- provider = "postgresql"
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "postgresql"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lang-database",
3
- "version": "16.1.0",
3
+ "version": "17.1.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/schema.prisma CHANGED
@@ -63,9 +63,15 @@ model UserStat {
63
63
  lastAnswerTimestamp DateTime
64
64
  todayActivitySec Int
65
65
  thisWeekActivitySec Int
66
- thisWeekActiveDays Int
67
66
  thisMonthActivitySec Int
67
+
68
+ thisWeekActiveDays Int
68
69
  thisMonthActiveDays Int
70
+
71
+ dailyGoalAchieved Boolean
72
+ weeklyGoalAchieved Boolean
73
+ monthlyGoalAchieved Boolean
74
+
69
75
  cardsDone Int
70
76
 
71
77
  @@id([userId])
@@ -106,6 +112,7 @@ model User {
106
112
  password String?
107
113
  googleUser GoogleUser?
108
114
  achievements Achievement[]
115
+ badges Badge[]
109
116
  subscriptions Subscription[]
110
117
  userCards UserCard[]
111
118
  userDecks UserDeck[]
@@ -129,6 +136,22 @@ model Achievement {
129
136
  @@map("achievements")
130
137
  }
131
138
 
139
+ model Badge {
140
+ id String @id @default(cuid())
141
+ user User @relation(fields: [userId], references: [id])
142
+ userId String
143
+ type BadgeReason
144
+ timestamp DateTime
145
+ @@map("badges")
146
+ }
147
+
148
+ enum BadgeReason {
149
+ WeeklyGoal
150
+ MonthlyGoal
151
+ ManyCardsDone
152
+ @@map("BadgeReason")
153
+ }
154
+
132
155
  enum AchievementType {
133
156
  Today15Min
134
157
  Weekly15Min