From 5f541e95240dbe79cfc4b8e0b81c54258c410784 Mon Sep 17 00:00:00 2001 From: Jaybe Date: Mon, 1 Dec 2025 03:24:38 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85,=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration.sql | 20 +++++++++++++++++++ prisma/schema.prisma | 3 +-- src/app/api/auth/login/route.ts | 2 +- src/app/api/auth/signup/route.ts | 2 +- src/app/api/image/[id]/route.ts | 2 +- src/app/api/image/route.ts | 2 +- src/app/api/projects/[slug]/route.ts | 2 +- src/app/api/projects/route.ts | 2 +- src/app/api/video/[id]/route.ts | 2 +- src/app/api/video/route.ts | 2 +- tests/api/auth.spec.ts | 2 +- tests/api/projects.spec.ts | 2 +- tests/api/videoUpload.spec.ts | 2 +- uploads/9540a579-27cc-4621-80b8-ff45cbc7440f | 1 + uploads/d7cc21c9-2513-43f7-bbb3-9dd1874077f7 | 1 + uploads/test-image-1764517380929 | 1 + uploads/test-image-1764519806365 | 1 + uploads/test-section-bg-1764517380960 | 1 + uploads/test-section-bg-1764519806383 | 1 + uploads/test-section-bg-video-1764517380987 | 1 + uploads/test-section-bg-video-1764519806407 | 1 + uploads/test-video-1764517380983 | 1 + uploads/test-video-1764519806401 | 1 + uploads/test-video-poster-1764517380947 | 1 + uploads/test-video-poster-1764519806372 | 1 + 25 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 prisma/migrations/20251130171523_add_user_model/migration.sql create mode 100644 uploads/9540a579-27cc-4621-80b8-ff45cbc7440f create mode 100644 uploads/d7cc21c9-2513-43f7-bbb3-9dd1874077f7 create mode 100644 uploads/test-image-1764517380929 create mode 100644 uploads/test-image-1764519806365 create mode 100644 uploads/test-section-bg-1764517380960 create mode 100644 uploads/test-section-bg-1764519806383 create mode 100644 uploads/test-section-bg-video-1764517380987 create mode 100644 uploads/test-section-bg-video-1764519806407 create mode 100644 uploads/test-video-1764517380983 create mode 100644 uploads/test-video-1764519806401 create mode 100644 uploads/test-video-poster-1764517380947 create mode 100644 uploads/test-video-poster-1764519806372 diff --git a/prisma/migrations/20251130171523_add_user_model/migration.sql b/prisma/migrations/20251130171523_add_user_model/migration.sql new file mode 100644 index 0000000..03a2cf0 --- /dev/null +++ b/prisma/migrations/20251130171523_add_user_model/migration.sql @@ -0,0 +1,20 @@ +-- AlterTable +ALTER TABLE "Project" ADD COLUMN "userId" TEXT; + +-- CreateTable +CREATE TABLE "User" ( + "id" TEXT NOT NULL, + "email" TEXT NOT NULL, + "passwordHash" TEXT NOT NULL, + "tokenVersion" INTEGER NOT NULL DEFAULT 0, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + +-- AddForeignKey +ALTER TABLE "Project" ADD CONSTRAINT "Project_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d8ec98b..d5ef0ad 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -5,8 +5,7 @@ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { - provider = "prisma-client" - output = "../src/generated/prisma" + provider = "prisma-client-js" binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x"] } diff --git a/src/app/api/auth/login/route.ts b/src/app/api/auth/login/route.ts index 62d26a1..b216c8a 100644 --- a/src/app/api/auth/login/route.ts +++ b/src/app/api/auth/login/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from "next/server"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; import { verifyPassword, signAccessToken } from "@/features/auth/authCrypto"; diff --git a/src/app/api/auth/signup/route.ts b/src/app/api/auth/signup/route.ts index 3413ed7..2cab297 100644 --- a/src/app/api/auth/signup/route.ts +++ b/src/app/api/auth/signup/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from "next/server"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; import { hashPassword, signAccessToken } from "@/features/auth/authCrypto"; diff --git a/src/app/api/image/[id]/route.ts b/src/app/api/image/[id]/route.ts index 894b07a..6f35340 100644 --- a/src/app/api/image/[id]/route.ts +++ b/src/app/api/image/[id]/route.ts @@ -1,7 +1,7 @@ import { NextResponse } from "next/server"; import { promises as fs } from "fs"; import path from "path"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; const UPLOAD_DIR = path.join(process.cwd(), "uploads"); diff --git a/src/app/api/image/route.ts b/src/app/api/image/route.ts index 13051fc..d4657cc 100644 --- a/src/app/api/image/route.ts +++ b/src/app/api/image/route.ts @@ -2,7 +2,7 @@ import { NextResponse } from "next/server"; import { promises as fs } from "fs"; import path from "path"; import { randomUUID } from "crypto"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; // 업로드된 이미지 파일을 저장할 디렉터리 (프로젝트 루트 기준) const UPLOAD_DIR = path.join(process.cwd(), "uploads"); diff --git a/src/app/api/projects/[slug]/route.ts b/src/app/api/projects/[slug]/route.ts index 1b6c076..b3e0479 100644 --- a/src/app/api/projects/[slug]/route.ts +++ b/src/app/api/projects/[slug]/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from "next/server"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; import { verifyAccessToken } from "@/features/auth/authCrypto"; const prisma = new PrismaClient(); diff --git a/src/app/api/projects/route.ts b/src/app/api/projects/route.ts index 7038adc..f722bc1 100644 --- a/src/app/api/projects/route.ts +++ b/src/app/api/projects/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from "next/server"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; import { verifyAccessToken } from "@/features/auth/authCrypto"; const prisma = new PrismaClient(); diff --git a/src/app/api/video/[id]/route.ts b/src/app/api/video/[id]/route.ts index 279be57..5c94d1f 100644 --- a/src/app/api/video/[id]/route.ts +++ b/src/app/api/video/[id]/route.ts @@ -1,7 +1,7 @@ import { NextResponse } from "next/server"; import { promises as fs } from "fs"; import path from "path"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; const UPLOAD_DIR = path.join(process.cwd(), "uploads"); diff --git a/src/app/api/video/route.ts b/src/app/api/video/route.ts index 0e64a1f..81d75a6 100644 --- a/src/app/api/video/route.ts +++ b/src/app/api/video/route.ts @@ -2,7 +2,7 @@ import { NextResponse } from "next/server"; import { promises as fs } from "fs"; import path from "path"; import { randomUUID } from "crypto"; -import { PrismaClient } from "@/generated/prisma/client"; +import { PrismaClient } from "@prisma/client"; // 업로드된 비디오 파일을 저장할 디렉터리 (프로젝트 루트 기준) const UPLOAD_DIR = path.join(process.cwd(), "uploads"); diff --git a/tests/api/auth.spec.ts b/tests/api/auth.spec.ts index 0be9fa2..8afce96 100644 --- a/tests/api/auth.spec.ts +++ b/tests/api/auth.spec.ts @@ -9,7 +9,7 @@ const BASE_URL = "http://localhost"; // 이렇게 하면 CI/로컬 어디에서도 DATABASE_URL 이나 실제 DB 없이 Auth API 테스트를 실행할 수 있다. const inMemoryUsers: any[] = []; -vi.mock("@/generated/prisma/client", () => { +vi.mock("@prisma/client", () => { class PrismaClientMock { user = { findUnique: async ({ where: { email } }: any) => { diff --git a/tests/api/projects.spec.ts b/tests/api/projects.spec.ts index 8390d29..3d870b1 100644 --- a/tests/api/projects.spec.ts +++ b/tests/api/projects.spec.ts @@ -6,7 +6,7 @@ import { signAccessToken } from "@/features/auth/authCrypto"; // 이렇게 하면 CI/로컬 어디에서도 DATABASE_URL 이나 실제 DB 없이 API 테스트를 실행할 수 있다. const inMemoryProjects: any[] = []; -vi.mock("@/generated/prisma/client", () => { +vi.mock("@prisma/client", () => { class PrismaClientMock { project = { create: async ({ data }: any) => { diff --git a/tests/api/videoUpload.spec.ts b/tests/api/videoUpload.spec.ts index 958c55c..b8608f2 100644 --- a/tests/api/videoUpload.spec.ts +++ b/tests/api/videoUpload.spec.ts @@ -10,7 +10,7 @@ const BASE_URL = "http://localhost"; // id / servedUrl(`/api/video/:id`) 을 반환해야 한다. // Prisma 엔진이 실제로 로드되지 않도록 PrismaClient 를 목 처리한다. -vi.mock("@/generated/prisma/client", () => { +vi.mock("@prisma/client", () => { class PrismaClient { project = { upsert: async () => ({ id: "project-mock" }), diff --git a/uploads/9540a579-27cc-4621-80b8-ff45cbc7440f b/uploads/9540a579-27cc-4621-80b8-ff45cbc7440f new file mode 100644 index 0000000..87ccacf --- /dev/null +++ b/uploads/9540a579-27cc-4621-80b8-ff45cbc7440f @@ -0,0 +1 @@ +dummy-video \ No newline at end of file diff --git a/uploads/d7cc21c9-2513-43f7-bbb3-9dd1874077f7 b/uploads/d7cc21c9-2513-43f7-bbb3-9dd1874077f7 new file mode 100644 index 0000000..87ccacf --- /dev/null +++ b/uploads/d7cc21c9-2513-43f7-bbb3-9dd1874077f7 @@ -0,0 +1 @@ +dummy-video \ No newline at end of file diff --git a/uploads/test-image-1764517380929 b/uploads/test-image-1764517380929 new file mode 100644 index 0000000..0cc5db2 --- /dev/null +++ b/uploads/test-image-1764517380929 @@ -0,0 +1 @@ +dummy-image \ No newline at end of file diff --git a/uploads/test-image-1764519806365 b/uploads/test-image-1764519806365 new file mode 100644 index 0000000..0cc5db2 --- /dev/null +++ b/uploads/test-image-1764519806365 @@ -0,0 +1 @@ +dummy-image \ No newline at end of file diff --git a/uploads/test-section-bg-1764517380960 b/uploads/test-section-bg-1764517380960 new file mode 100644 index 0000000..0cc5db2 --- /dev/null +++ b/uploads/test-section-bg-1764517380960 @@ -0,0 +1 @@ +dummy-image \ No newline at end of file diff --git a/uploads/test-section-bg-1764519806383 b/uploads/test-section-bg-1764519806383 new file mode 100644 index 0000000..0cc5db2 --- /dev/null +++ b/uploads/test-section-bg-1764519806383 @@ -0,0 +1 @@ +dummy-image \ No newline at end of file diff --git a/uploads/test-section-bg-video-1764517380987 b/uploads/test-section-bg-video-1764517380987 new file mode 100644 index 0000000..badc796 --- /dev/null +++ b/uploads/test-section-bg-video-1764517380987 @@ -0,0 +1 @@ +dummy-section-video \ No newline at end of file diff --git a/uploads/test-section-bg-video-1764519806407 b/uploads/test-section-bg-video-1764519806407 new file mode 100644 index 0000000..badc796 --- /dev/null +++ b/uploads/test-section-bg-video-1764519806407 @@ -0,0 +1 @@ +dummy-section-video \ No newline at end of file diff --git a/uploads/test-video-1764517380983 b/uploads/test-video-1764517380983 new file mode 100644 index 0000000..87ccacf --- /dev/null +++ b/uploads/test-video-1764517380983 @@ -0,0 +1 @@ +dummy-video \ No newline at end of file diff --git a/uploads/test-video-1764519806401 b/uploads/test-video-1764519806401 new file mode 100644 index 0000000..87ccacf --- /dev/null +++ b/uploads/test-video-1764519806401 @@ -0,0 +1 @@ +dummy-video \ No newline at end of file diff --git a/uploads/test-video-poster-1764517380947 b/uploads/test-video-poster-1764517380947 new file mode 100644 index 0000000..7285c92 --- /dev/null +++ b/uploads/test-video-poster-1764517380947 @@ -0,0 +1 @@ +dummy-poster \ No newline at end of file diff --git a/uploads/test-video-poster-1764519806372 b/uploads/test-video-poster-1764519806372 new file mode 100644 index 0000000..7285c92 --- /dev/null +++ b/uploads/test-video-poster-1764519806372 @@ -0,0 +1 @@ +dummy-poster \ No newline at end of file -- 2.52.0