lang-database 10.0.1 → 11.0.1

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.
package/.env.removed ADDED
@@ -0,0 +1,17 @@
1
+ # DATABASE_URL=postgresql://attila:A8JpZy_JhOM5uZm7QvIzAQ@free-tier7.aws-eu-west-1.cockroachlabs.cloud:26257/ezfraze-dev?sslmode=verify-full&options=--cluster%3Dday-bee-3717
2
+ DATABASE_URL=postgresql://attila:A8JpZy_JhOM5uZm7QvIzAQ@free-tier7.aws-eu-west-1.cockroachlabs.cloud:26257/ezfraze-prod-v2?sslmode=verify-full&options=--cluster%3Dday-bee-3717
3
+ # DATABASE_URL="postgresql://postgres:password@localhost:5432/ezfraze"
4
+ JWT_KEY=This is my jwt key
5
+ GOOGLE_CLIENT_ID=161628947473-h1575jmkaiqrgpo78nemsu2u4vk143ka.apps.googleusercontent.com
6
+
7
+ MAILERSEND_API_TOKEN=mlsn.90e8e408adf939502e682bf19949ee35f40eb1e6642333ab9870b371cc6e7de3
8
+ MAILERSEND_ACTVATION_TEMPLATE_ID=3z0vklonwwv47qrx
9
+
10
+ SPEECH_BUCKET_NAME=ezfraze-speech-sandbox
11
+
12
+ CHECKOUT_COM_SECRET_API_KEY=sk_sbox_y5bn577ag2jqybphho3vsm6gpim
13
+ CHECKOUT_COM_PAYMENT_URL=https://api.sandbox.checkout.com/payments
14
+ CHECKOUT_COM_PROCESSING_CHANNEL=pc_zj4dltodkn6uldfeyeisnol63q
15
+ PORT=6061
16
+
17
+ SUBSCRIPTION_DISABLED=true
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "userAnswers" ALTER COLUMN "reverse" DROP DEFAULT;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "lang-database",
3
- "version": "10.0.1",
3
+ "version": "11.0.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
+ "create-migration": "npx prisma migrate dev --create-only",
8
9
  "generate": "npx prisma generate",
9
10
  "push-dev-dbs": "npm run push-dev-db && npm run push-local-db && npm run push-test-db",
10
11
  "push-prod-db": "copy .env-prod .env && prisma db push --skip-generate",
package/schema.prisma CHANGED
@@ -141,7 +141,7 @@ model UserAnswer {
141
141
  userId String
142
142
  card Card @relation(fields: [cardId], references: [id], onDelete: Cascade)
143
143
  cardId String
144
- reverse Boolean @default(false)
144
+ reverse Boolean
145
145
  answer Answer
146
146
  timestamp DateTime
147
147
  @@map("userAnswers")
@@ -1,184 +0,0 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- }
4
-
5
- datasource db {
6
- provider = "cockroachdb"
7
- url = env("DATABASE_URL")
8
- shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
9
- }
10
-
11
- model Card {
12
- id String @id @default(cuid())
13
- packId String
14
- front String
15
- back String
16
- lastUpdate DateTime @default(now())
17
- speechGenerated Boolean @default(false)
18
- info String @default("")
19
- pack Pack @relation(fields: [packId], references: [id])
20
- answers UserAnswer[]
21
- userCards UserCard[]
22
-
23
- @@unique([packId, front])
24
- @@unique([packId, back])
25
- @@map("cards")
26
- }
27
-
28
- model UserCard {
29
- userId String
30
- cardId String
31
- currentInterval Int?
32
- dueDate DateTime?
33
- done Boolean @default(false)
34
- reverse Boolean @default(false)
35
- card Card @relation(fields: [cardId], references: [id], onDelete: Cascade)
36
- user User @relation(fields: [userId], references: [id])
37
-
38
- @@id([userId, cardId, reverse])
39
- @@unique([userId, cardId])
40
- @@map("userCards")
41
- }
42
-
43
- model Category {
44
- id String @id @default(cuid())
45
- name String
46
- packs Pack[]
47
-
48
- @@map("categories")
49
- }
50
-
51
- model Pack {
52
- id String @id @default(cuid())
53
- teacherId String
54
- name String @default("")
55
- shortDescription String @default("")
56
- longDescription String @default("")
57
- categoryId String?
58
- published Boolean @default(false)
59
- currentPrice Decimal
60
- public Boolean @default(false)
61
- cards Card[]
62
- category Category? @relation(fields: [categoryId], references: [id])
63
- teacher Teacher @relation(fields: [teacherId], references: [id])
64
- purchases Purchase[]
65
- teams Team[] @relation("PackToTeam")
66
- users User[] @relation("PackToUser")
67
-
68
- @@map("packs")
69
- }
70
-
71
- model User {
72
- id String @id @default(cuid())
73
- email String @unique(map: "IX_Users_Email")
74
- name String
75
- password String?
76
- teamId String?
77
- passwordActivated Boolean @default(false)
78
- timestamp DateTime @default(now())
79
- subscriptionExpire DateTime?
80
- achievements Achievement[]
81
- googleUser GoogleUser?
82
- purchases Purchase[]
83
- userAnswers UserAnswer[]
84
- userCards UserCard[]
85
- team Team? @relation(fields: [teamId], references: [id])
86
- packs Pack[] @relation("PackToUser")
87
-
88
- @@map("users")
89
- }
90
-
91
- model Achievement {
92
- id String @id @default(cuid())
93
- userId String
94
- badge Boolean
95
- type AchievementType
96
- info String
97
- timestamp DateTime
98
- dismissed Boolean @default(false)
99
- user User @relation(fields: [userId], references: [id])
100
-
101
- @@map("achievements")
102
- }
103
-
104
- model Team {
105
- id String @id @default(cuid())
106
- name String
107
- emailPattern String @default("")
108
- userCount Int
109
- subscriptionExpire DateTime?
110
- members User[]
111
- additionalDecks Pack[] @relation("PackToTeam")
112
-
113
- @@map("teams")
114
- }
115
-
116
- model Teacher {
117
- id String @id @default(cuid())
118
- email String @unique(map: "IX_teachers_Email")
119
- name String
120
- password String
121
- packs Pack[]
122
-
123
- @@map("teachers")
124
- }
125
-
126
- model GoogleUser {
127
- id String @id
128
- userId String @unique
129
- user User @relation(fields: [userId], references: [id])
130
-
131
- @@map("googleUsers")
132
- }
133
-
134
- model UserAnswer {
135
- id String @id @default(cuid())
136
- userId String
137
- cardId String
138
- timestamp DateTime
139
- answer Answer
140
- reverse Boolean @default(false)
141
- card Card @relation(fields: [cardId], references: [id], onDelete: Cascade)
142
- user User @relation(fields: [userId], references: [id])
143
-
144
- @@map("userAnswers")
145
- }
146
-
147
- model Purchase {
148
- id String @id @default(cuid())
149
- userId String
150
- packId String
151
- currency String
152
- amount Decimal
153
- orderDate DateTime
154
- paymentDate DateTime?
155
- status PurchaseStatus
156
- pack Pack @relation(fields: [packId], references: [id])
157
- user User @relation(fields: [userId], references: [id])
158
-
159
- @@map("purchases")
160
- }
161
-
162
- enum AchievementType {
163
- Today15Min
164
- Weekly15Min
165
- Monthly15Min
166
- CardDone
167
- DeckDone
168
- DeckAlreadyKnown
169
- FiveCardsDone
170
-
171
- @@map("AchievementType")
172
- }
173
-
174
- enum Answer {
175
- KNOWN
176
- ALMOST_KNOWN
177
- HARD
178
- UNKNOWN
179
- }
180
-
181
- enum PurchaseStatus {
182
- PENDING
183
- APPROVED
184
- }