Skip to content

Commit 3fa4e38

Browse files
committed
Simplified Modules for Auth and User
1 parent ac5df99 commit 3fa4e38

26 files changed

+261
-1230
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

+17-3
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:
2435
external: true
25-
redis:
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

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// This is your Prisma schema file,
2+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3+
4+
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5+
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6+
7+
generator client {
8+
provider = "prisma-client-js"
9+
}
10+
11+
datasource db {
12+
provider = "postgresql"
13+
url = env("DATABASE_URL")
14+
}
15+
16+
model User {
17+
id Int @id @unique @default(autoincrement())
18+
email String @unique
19+
name String?
20+
posts Post[]
21+
}
22+
23+
model Post {
24+
id Int @id @unique @default(autoincrement())
25+
title String
26+
content String?
27+
published Boolean @default(false)
28+
author User @relation(fields: [authorId], references: [id])
29+
authorId Int
30+
}

0 commit comments

Comments
 (0)