Skip to content

Commit 880f53c

Browse files
committed
🗃️ setup prisma orm with mongodb
1 parent 0daa453 commit 880f53c

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ lerna-debug.log*
3232
!.vscode/settings.json
3333
!.vscode/tasks.json
3434
!.vscode/launch.json
35-
!.vscode/extensions.json
35+
!.vscode/extensions.json
36+
37+
# environemnt variables
38+
.env
39+
.env.local
40+
.env.development
41+
.env.test
42+
.env.production

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"@nestjs/common": "^9.0.0",
2525
"@nestjs/core": "^9.0.0",
2626
"@nestjs/platform-express": "^9.0.0",
27+
"@prisma/client": "^4.4.0",
28+
"prisma": "^4.4.0",
2729
"reflect-metadata": "^0.1.13",
2830
"rimraf": "^3.0.2",
2931
"rxjs": "^7.2.0"

prisma/schema.prisma

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
}
4+
5+
datasource db {
6+
provider = "mongodb"
7+
url = env("DATABASE_URL")
8+
}
9+
10+
model User {
11+
id String @id @default(auto()) @map("_id") @db.ObjectId
12+
email String @unique
13+
name String
14+
password String
15+
profilePicture String?
16+
description String?
17+
createdAt DateTime @default(now())
18+
updatedAt DateTime @updatedAt
19+
favouritee User @relation(name: "favourite", fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction)
20+
favourites User[] @relation("favourite")
21+
userId String
22+
githubUsername String? @unique
23+
leetcodeUsername String? @unique
24+
codeforcesUsername String? @unique
25+
}

yarn.lock

+24
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,23 @@
766766
consola "^2.15.0"
767767
node-fetch "^2.6.1"
768768

769+
"@prisma/client@^4.4.0":
770+
version "4.4.0"
771+
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.4.0.tgz#45f59c172dd3621ecc92d7cf9bc765d85e6c7d56"
772+
integrity sha512-ciKOP246x1xwr04G9ajHlJ4pkmtu9Q6esVyqVBO0QJihaKQIUvbPjClp17IsRJyxqNpFm4ScbOc/s9DUzKHINQ==
773+
dependencies:
774+
"@prisma/engines-version" "4.4.0-66.f352a33b70356f46311da8b00d83386dd9f145d6"
775+
776+
"@prisma/engines-version@4.4.0-66.f352a33b70356f46311da8b00d83386dd9f145d6":
777+
version "4.4.0-66.f352a33b70356f46311da8b00d83386dd9f145d6"
778+
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.4.0-66.f352a33b70356f46311da8b00d83386dd9f145d6.tgz#00875863bb30b670a586a5b5794a000f7f3ad976"
779+
integrity sha512-P5v/PuEIJLYXZUZBvOLPqoyCW+m6StNqHdiR6te++gYVODpPdLakks5HVx3JaZIY+LwR02juJWFlwpc9Eog/ug==
780+
781+
782+
version "4.4.0"
783+
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-4.4.0.tgz#6ca7d3ce8eee08dcfa82311b0a02f5ccaac7dc0c"
784+
integrity sha512-Fpykccxlt9MHrAs/QpPGpI2nOiRxuLA+LiApgA59ibbf24YICZIMWd3SI2YD+q0IAIso0jCGiHhirAIbxK3RyQ==
785+
769786
"@sinclair/typebox@^0.24.1":
770787
version "0.24.44"
771788
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.44.tgz#0a0aa3bf4a155a678418527342a3ee84bd8caa5c"
@@ -3720,6 +3737,13 @@ pretty-format@^28.0.0, pretty-format@^28.1.3:
37203737
ansi-styles "^5.0.0"
37213738
react-is "^18.0.0"
37223739

3740+
prisma@^4.4.0:
3741+
version "4.4.0"
3742+
resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.4.0.tgz#0c53324bf6a29474636b3e1964e0d72e0277bf8f"
3743+
integrity sha512-l/QKLmLcKJQFuc+X02LyICo0NWTUVaNNZ00jKJBqwDyhwMAhboD1FWwYV50rkH4Wls0RviAJSFzkC2ZrfawpfA==
3744+
dependencies:
3745+
"@prisma/engines" "4.4.0"
3746+
37233747
process-nextick-args@~2.0.0:
37243748
version "2.0.1"
37253749
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"

0 commit comments

Comments
 (0)