Skip to content
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: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DATABASE_URL=
PORT=
JWT_SECRET=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dist-ssr
*.http
HTTP
temp
uploads
jsconfig.json

# Editor directories and files
Expand Down
943 changes: 899 additions & 44 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
"license": "ISC",
"description": "",
"dependencies": {
"@prisma/client": "^6.5.0",
"@prisma/client": "^6.7.0",
"bcrypt": "^5.1.1",
"cors": "^2.8.5",
"dotenv": "^16.4.7",
"express": "^4.21.2"
"express": "^4.21.2",
"express-jwt": "^8.5.1",
"jsonwebtoken": "^9.0.2",
"multer": "^1.4.5-lts.2"
},
"devDependencies": {
"@types/express": "^5.0.1",
"@types/node": "^22.13.10",
"nodemon": "^3.1.9",
"prisma": "^6.5.0",
"prisma": "^6.7.0",
"tsx": "^4.19.3",
"typescript": "^5.8.2"
},
"prisma": {
"schema": "./src/db/prisma/schema.prisma",
"seed": "node ./src/db/prisma/seed.js"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Warnings:

- You are about to drop the column `creatdAt` on the `Article` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE "Article" DROP COLUMN "creatdAt",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- DropForeignKey
ALTER TABLE "ArticleComment" DROP CONSTRAINT "ArticleComment_articleId_fkey";

-- DropForeignKey
ALTER TABLE "ProductComment" DROP CONSTRAINT "ProductComment_productId_fkey";

-- DropForeignKey
ALTER TABLE "ProductLike" DROP CONSTRAINT "ProductLike_productId_fkey";

-- AddForeignKey
ALTER TABLE "ProductComment" ADD CONSTRAINT "ProductComment_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ProductLike" ADD CONSTRAINT "ProductLike_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ArticleComment" ADD CONSTRAINT "ArticleComment_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE;
14 changes: 14 additions & 0 deletions prisma/migrations/20250509082904_add_user_field/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Warnings:

- You are about to drop the column `encryptedPassword` on the `User` table. All the data in the column will be lost.
- Added the required column `password` to the `User` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `User` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE "User" DROP COLUMN "encryptedPassword",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "image" TEXT,
ADD COLUMN "password" TEXT NOT NULL,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:

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

*/
-- CreateIndex
CREATE UNIQUE INDEX "User_nickname_key" ON "User"("nickname");
34 changes: 34 additions & 0 deletions prisma/migrations/20250512040355_add_like_model/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Warnings:

- A unique constraint covering the columns `[userId,productId]` on the table `ProductLike` will be added. If there are existing duplicate values, this will fail.
- Added the required column `userId` to the `ProductLike` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE "ProductLike" ADD COLUMN "userId" TEXT NOT NULL;

-- CreateTable
CREATE TABLE "ArticleLike" (
"id" SERIAL NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" TEXT NOT NULL,
"articleId" INTEGER NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "ArticleLike_userId_articleId_key" ON "ArticleLike"("userId", "articleId");

-- CreateIndex
CREATE UNIQUE INDEX "ProductLike_userId_productId_key" ON "ProductLike"("userId", "productId");

-- AddForeignKey
ALTER TABLE "ProductLike" ADD CONSTRAINT "ProductLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ArticleLike" ADD CONSTRAINT "ArticleLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ArticleLike" ADD CONSTRAINT "ArticleLike_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "ProductImage" (
"id" SERIAL NOT NULL,
"imageUrl" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" TEXT NOT NULL,
"productId" INTEGER NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "ProductImage_imageUrl_key" ON "ProductImage"("imageUrl");

-- AddForeignKey
ALTER TABLE "ProductImage" ADD CONSTRAINT "ProductImage_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ProductImage" ADD CONSTRAINT "ProductImage_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
30 changes: 30 additions & 0 deletions prisma/migrations/20250518150827_add_author_field/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Warnings:

- Added the required column `authorId` to the `Article` table without a default value. This is not possible if the table is not empty.
- Added the required column `authorId` to the `ArticleComment` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE "Article" ADD COLUMN "authorId" TEXT NOT NULL;

-- AlterTable
ALTER TABLE "ArticleComment" ADD COLUMN "authorId" TEXT NOT NULL;

-- AlterTable
ALTER TABLE "Product" ADD COLUMN "authorId" TEXT;

-- AlterTable
ALTER TABLE "ProductComment" ADD COLUMN "authorId" TEXT;

-- AddForeignKey
ALTER TABLE "Product" ADD CONSTRAINT "Product_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ProductComment" ADD CONSTRAINT "ProductComment_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Article" ADD CONSTRAINT "Article_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ArticleComment" ADD CONSTRAINT "ArticleComment_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:

- Made the column `authorId` on table `Product` required. This step will fail if there are existing NULL values in that column.
- Made the column `authorId` on table `ProductComment` required. This step will fail if there are existing NULL values in that column.

*/
-- AlterTable
ALTER TABLE "Product" ALTER COLUMN "authorId" SET NOT NULL;

-- AlterTable
ALTER TABLE "ProductComment" ALTER COLUMN "authorId" SET NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- DropForeignKey
ALTER TABLE "ArticleLike" DROP CONSTRAINT "ArticleLike_articleId_fkey";

-- DropForeignKey
ALTER TABLE "ArticleLike" DROP CONSTRAINT "ArticleLike_userId_fkey";

-- DropForeignKey
ALTER TABLE "ProductImage" DROP CONSTRAINT "ProductImage_productId_fkey";

-- DropForeignKey
ALTER TABLE "ProductImage" DROP CONSTRAINT "ProductImage_userId_fkey";

-- AddForeignKey
ALTER TABLE "ProductImage" ADD CONSTRAINT "ProductImage_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ProductImage" ADD CONSTRAINT "ProductImage_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ArticleLike" ADD CONSTRAINT "ArticleLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ArticleLike" ADD CONSTRAINT "ArticleLike_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
provider = "postgresql"
10 changes: 5 additions & 5 deletions src/db/prisma/mock/articleMock.js → prisma/mock/articleMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ const ARTICLE_MOCK = [
const ARTICLE_COMMENT_MOCK = [
{
content: "댓글 시드 데이터 1",
articleId: 33,
articleId: 1,
},
{
content: "댓글 시드 데이터 2",
articleId: 34,
articleId: 2,
},
{
content: "댓글 시드 데이터 3",
articleId: 35,
articleId: 3,
},
{
content: "댓글 시드 데이터 4",
articleId: 36,
articleId: 4,
},
{
content: "댓글 시드 데이터 5",
articleId: 37,
articleId: 5,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,26 @@ const PRODUCT_MOCK = [
name: "상품 시드 데이터 1",
description: "상품 설명 시드 데이터 1",
price: 10000,
tags: "상품 태그 시드 데이터 1",
},
{
name: "상품 시드 데이터 2",
description: "상품 설명 시드 데이터 2",
price: 20000,
tags: "상품 태그 시드 데이터 2",
},
{
name: "상품 시드 데이터 3",
description: "상품 설명 시드 데이터 3",
price: 30000,
tags: "상품 태그 시드 데이터 3",
},
{
name: "상품 시드 데이터 4",
description: "상품 설명 시드 데이터 4",
price: 40000,
tags: "상품 태그 시드 데이터 4",
},
{
name: "상품 시드 데이터 5",
description: "상품 설명 시드 데이터 5",
price: 50000,
tags: "상품 태그 시드 데이터 5",
},
];

Expand Down
Loading