Skip to content

Modules separated #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,3 @@ dist

# database
.database

# firebase
firebase-adminsdk-creds.json
22 changes: 18 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,25 @@ services:
redis:
image: redis:latest
ports:
- 6379:6379
- 6380:6379
volumes:
- redis:/data
- redis_typescript_backend_toolkit:/data

postgres:
image: postgres:15
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: admin
POSTGRES_DB: root
ports:
- 5432:5432
volumes:
- postgres_typescript_backend_toolkit:/var/lib/postgresql/data

volumes:
mongodb_typescript_backend_toolkit:
# external: true
redis:
external: true
redis_typescript_backend_toolkit:
external: true
postgres_typescript_backend_toolkit:
external: true
1 change: 1 addition & 0 deletions firebase-adminsdk-creds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
58 changes: 0 additions & 58 deletions openapi-docs.yml

This file was deleted.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"start:prod": "dotenv -e .env -- node ./dist/main.js",
"start:local": "dotenv -e .env -- node ./dist/main.js",
"lint": "eslint",
"lint:fix": "eslint --fix"
"lint:fix": "eslint --fix",
"migrate:dev": "pnpm dlx prisma migrate dev",
"migrate:deploy": "pnpm dlx prisma migrate deploy"
},
"devDependencies": {
"@eslint/js": "^9.4.0",
Expand Down Expand Up @@ -40,6 +42,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"globals": "^15.3.0",
"prisma": "^5.18.0",
"rimraf": "^5.0.1",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
Expand Down
44 changes: 42 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions prisma/migrations/20240815141534_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Post" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT,
"published" BOOLEAN NOT NULL DEFAULT false,
"authorId" INTEGER NOT NULL,

CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- AddForeignKey
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
12 changes: 12 additions & 0 deletions prisma/migrations/20240815142412_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:

- A unique constraint covering the columns `[id]` on the table `Post` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id]` on the table `User` will be added. If there are existing duplicate values, this will fail.

*/
-- CreateIndex
CREATE UNIQUE INDEX "Post_id_key" ON "Post"("id");

-- CreateIndex
CREATE UNIQUE INDEX "User_id_key" ON "User"("id");
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
38 changes: 38 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// schema.prisma

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

// User Management
model User {
id Int @id @default(autoincrement())
email String @unique
name String
password String
posts Post[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@unique([id])
@@index([id])
}

// Blog Post
model Post {
id Int @id @default(autoincrement())
title String
content String
author User @relation(fields: [authorId], references: [id])
authorId Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@unique([id])
@@index([id])
}
Loading