lang-database 1.1.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.
@@ -0,0 +1,96 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ output = "./generated/prisma-client"
4
+ }
5
+
6
+ datasource db {
7
+ provider = "sqlite"
8
+ url = env("DATABASE_URL")
9
+ shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
10
+ }
11
+
12
+ model Card {
13
+ id Int @id @default(autoincrement())
14
+ pack Pack @relation(fields: [packId], references: [id])
15
+ packId Int
16
+ front String
17
+ back String
18
+ userCards UserCard[]
19
+ answers Answer[] @ignore
20
+
21
+ @@map("cards")
22
+ }
23
+
24
+ model UserCard {
25
+ user User @relation(fields: [userId], references: [id])
26
+ userId Int
27
+ card Card @relation(fields: [cardId], references: [id])
28
+ cardId Int
29
+ currentInterval Int?
30
+ dueDate DateTime?
31
+ done Boolean
32
+
33
+ @@id([userId, cardId])
34
+ @@map("userCards")
35
+ }
36
+
37
+ model Pack {
38
+ id Int @id @default(autoincrement())
39
+ admin Admin @relation(fields: [adminId], references: [id])
40
+ adminId Int
41
+ name String
42
+ cards Card[]
43
+ users User[]
44
+ purchase Purchase[]
45
+ currentPrice Decimal
46
+ @@map("packs")
47
+ }
48
+
49
+ model User {
50
+ id Int @id @default(autoincrement())
51
+ email String @unique(map: "IX_Users_Email")
52
+ name String
53
+ googleUser GoogleUser?
54
+ purchases Purchase[]
55
+ packs Pack[]
56
+ userCards UserCard[]
57
+ answers Answer[]
58
+ @@map("users")
59
+ }
60
+
61
+ model Admin {
62
+ id Int @id @default(autoincrement())
63
+ email String @unique(map: "IX_Admins_Email")
64
+ name String
65
+ password String
66
+ packs Pack[]
67
+ @@map("admins")
68
+ }
69
+
70
+ model GoogleUser {
71
+ id String @id
72
+ user User @relation(fields: [userId], references: [id])
73
+ userId Int @unique
74
+ @@map("googleUsers")
75
+ }
76
+
77
+ model Answer {
78
+ id Int @id @default(autoincrement())
79
+ user User @relation(fields: [userId], references: [id])
80
+ userId Int
81
+ card Card @relation(fields: [cardId], references: [id])
82
+ cardId Int
83
+ status String
84
+ timestamp String
85
+ @@map("answers")
86
+ }
87
+
88
+ model Purchase {
89
+ id Int @id @default(autoincrement())
90
+ user User @relation(fields: [userId], references: [id])
91
+ userId Int
92
+ pack Pack @relation(fields: [packId], references: [id])
93
+ packId Int
94
+ price String
95
+ @@map("purchases")
96
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "lang-database",
3
+ "version": "1.1.1",
4
+ "description": "",
5
+ "main": "generated/prisma-client/index.js",
6
+ "types": "generated/prisma-client/index.d.ts",
7
+ "scripts": {
8
+ "generate": "prisma generate",
9
+ "push-dev-dbs": "npm run push-dev-db && npm run push-dev-test-db",
10
+ "push-dev-db": "copy .env-dev .env && prisma db push --skip-generate",
11
+ "push-dev-test-db": "copy .env-test .env && prisma db push --skip-generate",
12
+ "test": "echo \"Error: no test specified\" && exit 1"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://bitbucket.org/syke80/lang-database.git"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "bugs": {
22
+ "url": "https://bitbucket.org/syke80/lang-database/issues"
23
+ },
24
+ "homepage": "https://bitbucket.org/syke80/lang-database#readme",
25
+ "dependencies": {
26
+ "@prisma/client": "^4.3.1",
27
+ "prisma": "^4.3.1"
28
+ }
29
+ }
package/schema.prisma ADDED
@@ -0,0 +1,96 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ output = "./generated/prisma-client"
4
+ }
5
+
6
+ datasource db {
7
+ provider = "sqlite"
8
+ url = env("DATABASE_URL")
9
+ shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
10
+ }
11
+
12
+ model Card {
13
+ id Int @id @default(autoincrement())
14
+ pack Pack @relation(fields: [packId], references: [id])
15
+ packId Int
16
+ front String
17
+ back String
18
+ userCards UserCard[]
19
+ answers Answer[] @ignore
20
+
21
+ @@map("cards")
22
+ }
23
+
24
+ model UserCard {
25
+ user User @relation(fields: [userId], references: [id])
26
+ userId Int
27
+ card Card @relation(fields: [cardId], references: [id])
28
+ cardId Int
29
+ currentInterval Int?
30
+ dueDate DateTime?
31
+ done Boolean
32
+
33
+ @@id([userId, cardId])
34
+ @@map("userCards")
35
+ }
36
+
37
+ model Pack {
38
+ id Int @id @default(autoincrement())
39
+ admin Admin @relation(fields: [adminId], references: [id])
40
+ adminId Int
41
+ name String
42
+ cards Card[]
43
+ users User[]
44
+ purchase Purchase[]
45
+ currentPrice Decimal
46
+ @@map("packs")
47
+ }
48
+
49
+ model User {
50
+ id Int @id @default(autoincrement())
51
+ email String @unique(map: "IX_Users_Email")
52
+ name String
53
+ googleUser GoogleUser?
54
+ purchases Purchase[]
55
+ packs Pack[]
56
+ userCards UserCard[]
57
+ answers Answer[]
58
+ @@map("users")
59
+ }
60
+
61
+ model Admin {
62
+ id Int @id @default(autoincrement())
63
+ email String @unique(map: "IX_Admins_Email")
64
+ name String
65
+ password String
66
+ packs Pack[]
67
+ @@map("admins")
68
+ }
69
+
70
+ model GoogleUser {
71
+ id String @id
72
+ user User @relation(fields: [userId], references: [id])
73
+ userId Int @unique
74
+ @@map("googleUsers")
75
+ }
76
+
77
+ model Answer {
78
+ id Int @id @default(autoincrement())
79
+ user User @relation(fields: [userId], references: [id])
80
+ userId Int
81
+ card Card @relation(fields: [cardId], references: [id])
82
+ cardId Int
83
+ status String
84
+ timestamp String
85
+ @@map("answers")
86
+ }
87
+
88
+ model Purchase {
89
+ id Int @id @default(autoincrement())
90
+ user User @relation(fields: [userId], references: [id])
91
+ userId Int
92
+ pack Pack @relation(fields: [packId], references: [id])
93
+ packId Int
94
+ price String
95
+ @@map("purchases")
96
+ }