Skip to content

Commit ac65a06

Browse files
Merge pull request #7 from muneebhashone/modules-separated
Modules separated
2 parents 9aa00f1 + c81426a commit ac65a06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+796
-1938
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,3 @@ dist
131131

132132
# database
133133
.database
134-
135-
# firebase
136-
firebase-adminsdk-creds.json

docker-compose.yml

+18-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,25 @@ services:
1515
redis:
1616
image: redis:latest
1717
ports:
18-
- 6379:6379
18+
- 6380:6379
1919
volumes:
20-
- redis:/data
20+
- redis_typescript_backend_toolkit:/data
21+
22+
postgres:
23+
image: postgres:15
24+
environment:
25+
POSTGRES_USER: root
26+
POSTGRES_PASSWORD: admin
27+
POSTGRES_DB: root
28+
ports:
29+
- 5432:5432
30+
volumes:
31+
- postgres_typescript_backend_toolkit:/var/lib/postgresql/data
2132

2233
volumes:
2334
mongodb_typescript_backend_toolkit:
24-
# external: true
25-
redis:
35+
external: true
36+
redis_typescript_backend_toolkit:
37+
external: true
38+
postgres_typescript_backend_toolkit:
39+
external: true

firebase-adminsdk-creds.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

openapi-docs.yml

-58
This file was deleted.

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"start:prod": "dotenv -e .env -- node ./dist/main.js",
1111
"start:local": "dotenv -e .env -- node ./dist/main.js",
1212
"lint": "eslint",
13-
"lint:fix": "eslint --fix"
13+
"lint:fix": "eslint --fix",
14+
"migrate:dev": "pnpm dlx prisma migrate dev",
15+
"migrate:deploy": "pnpm dlx prisma migrate deploy"
1416
},
1517
"devDependencies": {
1618
"@eslint/js": "^9.4.0",
@@ -40,6 +42,7 @@
4042
"eslint-plugin-import": "^2.29.1",
4143
"eslint-plugin-prettier": "^5.1.3",
4244
"globals": "^15.3.0",
45+
"prisma": "^5.18.0",
4346
"rimraf": "^5.0.1",
4447
"ts-node": "^10.9.1",
4548
"ts-node-dev": "^2.0.0",

pnpm-lock.yaml

+42-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- CreateTable
2+
CREATE TABLE "User" (
3+
"id" SERIAL NOT NULL,
4+
"email" TEXT NOT NULL,
5+
"name" TEXT,
6+
7+
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
8+
);
9+
10+
-- CreateTable
11+
CREATE TABLE "Post" (
12+
"id" SERIAL NOT NULL,
13+
"title" TEXT NOT NULL,
14+
"content" TEXT,
15+
"published" BOOLEAN NOT NULL DEFAULT false,
16+
"authorId" INTEGER NOT NULL,
17+
18+
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
19+
);
20+
21+
-- CreateIndex
22+
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
23+
24+
-- AddForeignKey
25+
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
Warnings:
3+
4+
- A unique constraint covering the columns `[id]` on the table `Post` will be added. If there are existing duplicate values, this will fail.
5+
- A unique constraint covering the columns `[id]` on the table `User` will be added. If there are existing duplicate values, this will fail.
6+
7+
*/
8+
-- CreateIndex
9+
CREATE UNIQUE INDEX "Post_id_key" ON "Post"("id");
10+
11+
-- CreateIndex
12+
CREATE UNIQUE INDEX "User_id_key" ON "User"("id");

prisma/migrations/migration_lock.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (i.e. Git)
3+
provider = "postgresql"

prisma/schema.prisma

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// schema.prisma
2+
3+
generator client {
4+
provider = "prisma-client-js"
5+
}
6+
7+
datasource db {
8+
provider = "postgresql"
9+
url = env("DATABASE_URL")
10+
}
11+
12+
// User Management
13+
model User {
14+
id Int @id @default(autoincrement())
15+
email String @unique
16+
name String
17+
password String
18+
posts Post[]
19+
createdAt DateTime @default(now())
20+
updatedAt DateTime @updatedAt
21+
22+
@@unique([id])
23+
@@index([id])
24+
}
25+
26+
// Blog Post
27+
model Post {
28+
id Int @id @default(autoincrement())
29+
title String
30+
content String
31+
author User @relation(fields: [authorId], references: [id])
32+
authorId Int
33+
createdAt DateTime @default(now())
34+
updatedAt DateTime @updatedAt
35+
36+
@@unique([id])
37+
@@index([id])
38+
}

0 commit comments

Comments
 (0)