Skip to content

Commit ce9b592

Browse files
committed
update resolvers
1 parent 2ebb56d commit ce9b592

File tree

16 files changed

+887
-183
lines changed

16 files changed

+887
-183
lines changed

server/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
"license": "MIT",
55
"scripts": {
66
"start": "node src/index.js",
7-
"prisma": "prisma"
7+
"dev": "nodemon src/index.js"
88
},
99
"dependencies": {
1010
"@prisma/client": "^2.8.0",
1111
"apollo-server": "^2.18.2",
1212
"bcryptjs": "^2.4.3",
13+
"graphql": "^15.3.0",
1314
"jsonwebtoken": "^8.2.0"
1415
},
1516
"devDependencies": {
16-
"@prisma/cli": "^2.8.0"
17+
"@prisma/cli": "^2.8.0",
18+
"nodemon": "^2.0.4"
1719
}
1820
}

server/prisma/dev.db

56 KB
Binary file not shown.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Migration `20201007154524-init`
2+
3+
This migration has been generated by Ryan Chenkie at 10/7/2020, 11:45:24 AM.
4+
You can check out the [state of the schema](./schema.prisma) after the migration.
5+
6+
## Database Steps
7+
8+
```sql
9+
CREATE TABLE "Link" (
10+
"id" TEXT NOT NULL,
11+
"description" TEXT NOT NULL,
12+
"url" TEXT NOT NULL,
13+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14+
"userId" TEXT NOT NULL,
15+
16+
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
17+
PRIMARY KEY ("id")
18+
)
19+
20+
CREATE TABLE "User" (
21+
"id" TEXT NOT NULL,
22+
"name" TEXT NOT NULL,
23+
"email" TEXT NOT NULL,
24+
"password" TEXT NOT NULL,
25+
PRIMARY KEY ("id")
26+
)
27+
28+
CREATE TABLE "Vote" (
29+
"id" TEXT NOT NULL,
30+
"linkId" TEXT NOT NULL,
31+
"userId" TEXT NOT NULL,
32+
33+
FOREIGN KEY ("linkId") REFERENCES "Link"("id") ON DELETE CASCADE ON UPDATE CASCADE,
34+
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
35+
PRIMARY KEY ("id")
36+
)
37+
```
38+
39+
## Changes
40+
41+
```diff
42+
diff --git schema.prisma schema.prisma
43+
migration ..20201007154524-init
44+
--- datamodel.dml
45+
+++ datamodel.dml
46+
@@ -1,0 +1,38 @@
47+
+// This is your Prisma schema file,
48+
+// learn more about it in the docs: https://pris.ly/d/prisma-schema
49+
+
50+
+datasource db {
51+
+ provider = "sqlite"
52+
+ url = "***"
53+
+}
54+
+
55+
+generator client {
56+
+ provider = "prisma-client-js"
57+
+}
58+
+
59+
+model Link {
60+
+ id String @id @default(cuid())
61+
+ description String
62+
+ url String
63+
+ createdAt DateTime @default(now())
64+
+ postedBy User @relation(fields: [userId], references: [id])
65+
+ votes Vote[]
66+
+ userId String
67+
+}
68+
+
69+
+model User {
70+
+ id String @id @default(cuid())
71+
+ name String
72+
+ email String
73+
+ password String
74+
+ links Link[]
75+
+ votes Vote[]
76+
+}
77+
+
78+
+model Vote {
79+
+ id String @id @default(cuid())
80+
+ link Link @relation(fields: [linkId], references: [id])
81+
+ user User @relation(fields: [userId], references: [id])
82+
+ linkId String
83+
+ userId String
84+
+}
85+
```
86+
87+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// This is your Prisma schema file,
2+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3+
4+
datasource db {
5+
provider = "sqlite"
6+
url = "***"
7+
}
8+
9+
generator client {
10+
provider = "prisma-client-js"
11+
}
12+
13+
model Link {
14+
id String @id @default(cuid())
15+
description String
16+
url String
17+
createdAt DateTime @default(now())
18+
postedBy User @relation(fields: [userId], references: [id])
19+
votes Vote[]
20+
userId String
21+
}
22+
23+
model User {
24+
id String @id @default(cuid())
25+
name String
26+
email String
27+
password String
28+
links Link[]
29+
votes Vote[]
30+
}
31+
32+
model Vote {
33+
id String @id @default(cuid())
34+
link Link @relation(fields: [linkId], references: [id])
35+
user User @relation(fields: [userId], references: [id])
36+
linkId String
37+
userId String
38+
}

0 commit comments

Comments
 (0)