From eaa37ccb72529a2375a11d08b7c755525a4b5365 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 1 Oct 2025 13:32:13 +0000 Subject: [PATCH 01/88] =?UTF-8?q?Malsami-FE=20=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20:=20docs=20:=20v0.1.25=20README=20?= =?UTF-8?q?=EB=B2=84=EC=A0=84=20=EC=A0=95=EB=B3=B4=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 838e4a10..dfe438ad 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ -## 최신 버전 : v0.1.21 (2025-09-05) +## 최신 버전 : v0.1.25 (2025-10-01) [전체 버전 기록 보기](CHANGELOG.md) From 0415cde8d97f1dca875502e9a681d6a2fd4db6bd Mon Sep 17 00:00:00 2001 From: thwogh Date: Wed, 1 Oct 2025 23:25:40 +0900 Subject: [PATCH 02/88] =?UTF-8?q?=EC=9E=90=EB=A3=8C=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20UI=20=EA=B8=B0=EB=8A=A5=20=EC=88=98=EC=A0=95=20:=20?= =?UTF-8?q?fix:=20build=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20https://g?= =?UTF-8?q?ithub.com/Sejong-Balsamic/Malsami-FE/issues/643?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/board/document/sub/hot-download/page.tsx | 1 - src/app/board/document/sub/request/page.tsx | 1 - src/app/board/document/tier/[postTier]/page.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/src/app/board/document/sub/hot-download/page.tsx b/src/app/board/document/sub/hot-download/page.tsx index 48bce7ce..1caa2d32 100644 --- a/src/app/board/document/sub/hot-download/page.tsx +++ b/src/app/board/document/sub/hot-download/page.tsx @@ -145,7 +145,6 @@ export default function HotDownloadPage() { onConfirm={handleDocumentConfirm} currentFiltering={currentFiltering} trigger={
} // 빈 트리거 (Header의 메뉴 버튼으로 제어) - activeColor="#00D1F2" // 파란색 테마 />
); diff --git a/src/app/board/document/sub/request/page.tsx b/src/app/board/document/sub/request/page.tsx index 9b72288b..1064acab 100644 --- a/src/app/board/document/sub/request/page.tsx +++ b/src/app/board/document/sub/request/page.tsx @@ -143,7 +143,6 @@ export default function DocumentRequestPage() { onConfirm={handleDocumentConfirm} currentFiltering={currentFiltering} // 현재 적용된 필터링 상태 전달 trigger={
} // 빈 트리거 (Header의 메뉴 버튼으로 제어) - activeColor="#00D1F2" // 파란색 테마 />
); diff --git a/src/app/board/document/tier/[postTier]/page.tsx b/src/app/board/document/tier/[postTier]/page.tsx index 7942039c..ca959911 100644 --- a/src/app/board/document/tier/[postTier]/page.tsx +++ b/src/app/board/document/tier/[postTier]/page.tsx @@ -242,7 +242,6 @@ export default function DocumentTierPage({ params }: DocumentTierPageProps) { onConfirm={handleDocumentConfirm} currentFiltering={currentFiltering} trigger={
} // 빈 트리거 (Header의 메뉴 버튼으로 제어) - activeColor="#00D1F2" // 파란색 테마 />
); From 90688e771546777b4596aad7955811e8c95322c8 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 1 Oct 2025 15:19:43 +0000 Subject: [PATCH 03/88] =?UTF-8?q?Malsami-FE=20=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EA=B4=80=EB=A6=AC:=20chore:=20=EB=B2=84?= =?UTF-8?q?=EC=A0=84=200.1.26=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- version.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 930c88c7..e2d4a9ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "malsami-fe", - "version": "0.1.25", + "version": "0.1.26", "private": true, "scripts": { "dev": "next dev", diff --git a/version.yml b/version.yml index 4526d532..e11694b6 100644 --- a/version.yml +++ b/version.yml @@ -6,7 +6,7 @@ # GitHub Actions 워크플로우가 이 파일을 읽어 자동으로 버전을 관리 # # 사용법: -# 1. version: "0.1.25" +# 1. version: "0.1.26" # 2. project_type: 프로젝트 타입 지정 # # 자동 버전 업데이트: @@ -15,7 +15,7 @@ # # 프로젝트 타입별 동기화 파일: # - spring: build.gradle (version = "x.y.z") -# - flutter: pubspec.yaml (version: "0.1.25" +# - flutter: pubspec.yaml (version: "0.1.26" # - react/node: package.json ("version": "x.y.z") # - react-native: iOS Info.plist 또는 Android build.gradle # - react-native-expo: app.json (expo.version) @@ -26,8 +26,8 @@ # - 버전은 항상 높은 버전으로 자동 동기화됩니다 # =================================================================== -version: "0.1.25" +version: "0.1.26" project_type: "react" # spring, flutter, react, react-native, react-native-expo, node, basic metadata: - last_updated: "2025-10-01 13:29:49" - last_updated_by: "Cassiiopeia" + last_updated: "2025-10-01 15:19:42" + last_updated_by: "thswogh" From 034c2936936d2b44c2190f607cc234095b461f5e Mon Sep 17 00:00:00 2001 From: SUH SAECHAN <83532821+Cassiiopeia@users.noreply.github.com> Date: Wed, 17 Jun 2026 00:14:22 +0900 Subject: [PATCH 04/88] =?UTF-8?q?=EC=A7=88=EB=AC=B8=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=C2=B7=EB=8B=B5=EB=B3=80=C2=B7=EB=8C=93=EA=B8=80=20=EA=B5=AC?= =?UTF-8?q?=EC=8B=9D=20API=20=EC=8B=A0=EC=8B=9D=20=ED=8C=A8=ED=84=B4=20?= =?UTF-8?q?=ED=86=B5=EC=9D=BC=20:=20refactor=20:=20apis/question/*=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=ED=98=95=20=ED=98=B8=EC=B6=9C=EC=9D=84=20que?= =?UTF-8?q?stionPostApi=C2=B7answerPostApi=EB=A1=9C=20=EA=B5=90=EC=B2=B4?= =?UTF-8?q?=ED=95=98=EA=B3=A0=20=EC=A3=BD=EC=9D=80=20CommentInput=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20https://github.com/Sejong-Balsamic/Malsami?= =?UTF-8?q?-FE/issues/649?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...34_deprecated_\354\240\234\352\261\260.md" | 26 ++++++ ...40\354\213\235\355\206\265\354\235\274.md" | 31 +++++++ ...0\355\201\260_\355\206\265\354\235\274.md" | 30 ++++++ ...54\354\241\260\354\240\225\353\246\254.md" | 26 ++++++ ...230\201API_\352\262\200\354\246\235_QA.md" | 23 +++++ package-lock.json | 4 +- .../question/detail/[id]/answer/page.tsx | 14 +-- .../question/detail/[id]/comment/page.tsx | 5 +- src/app/board/question/detail/[id]/page.tsx | 5 +- .../questionDetail/AnswerSection.tsx | 7 +- .../questionDetail/ChaetaekCheckModal.tsx | 6 +- .../questionDetail/CommentInput.tsx | 91 ------------------- 12 files changed, 159 insertions(+), 109 deletions(-) create mode 100644 "docs/suh-template/issue/20260617_648_\353\240\210\352\261\260\354\213\234_deprecated_\354\240\234\352\261\260.md" create mode 100644 "docs/suh-template/issue/20260617_649_\354\247\210\353\254\270\354\203\201\354\204\270_API_\354\213\240\354\213\235\355\206\265\354\235\274.md" create mode 100644 "docs/suh-template/issue/20260617_650_\354\212\244\355\203\200\354\235\274_\353\224\224\354\236\220\354\235\270\355\206\240\355\201\260_\355\206\265\354\235\274.md" create mode 100644 "docs/suh-template/issue/20260617_651_common_\355\217\264\353\215\224_\352\265\254\354\241\260\354\240\225\353\246\254.md" create mode 100644 "docs/suh-template/issue/20260617_652_\354\232\264\354\230\201API_\352\262\200\354\246\235_QA.md" delete mode 100644 src/components/questionDetail/CommentInput.tsx diff --git "a/docs/suh-template/issue/20260617_648_\353\240\210\352\261\260\354\213\234_deprecated_\354\240\234\352\261\260.md" "b/docs/suh-template/issue/20260617_648_\353\240\210\352\261\260\354\213\234_deprecated_\354\240\234\352\261\260.md" new file mode 100644 index 00000000..c35a39c9 --- /dev/null +++ "b/docs/suh-template/issue/20260617_648_\353\240\210\352\261\260\354\213\234_deprecated_\354\240\234\352\261\260.md" @@ -0,0 +1,26 @@ +## 📝 현재 문제점 + +옛 디자인에서 새 디자인으로 전환하는 과정이 절반만 진행되어, 사용하지 않는 레거시 코드가 대량으로 방치되어 있습니다. + +- `src/deprecated/` 외 deprecated 폴더에 **약 89개 파일**이 남아 있으나, 실제 살아있는 코드가 import하는 것은 단 **2곳**뿐입니다. + - `src/components/documentDetail/DocDetail.tsx` → `@/deprecated/DCommentSection` + - `src/components/documentMain/TierBoard.tsx` → `@/deprecated/DocTierPageNav` +- 나머지 약 87개 파일(`src/deprecated/*`, `src/apis/deprecated/*`, `src/components/deprecated/*`, `src/components/common/deprecated/*`)은 **아무도 import하지 않는 죽은 코드**입니다. +- 죽은 코드가 IDE 자동완성·검색·코드 리뷰를 오염시키고, 신규 작업 시 어떤 컴포넌트가 진짜인지 혼란을 유발합니다. + +## 🛠️ 해결 방안 / 제안 기능 + +⚙️ 작업 내용 +--- +- `DocDetail.tsx`의 `DCommentSection` 의존을 신식 댓글 컴포넌트로 교체 (CommentSection 신규/재사용) +- `TierBoard.tsx`의 `DocTierPageNav` 의존을 신식 공통 헤더(CommonHeader 계열)로 교체 +- 위 2곳 교체 후 빌드가 통과하면, 사용하지 않는 deprecated 폴더 전체를 삭제: + - `src/deprecated/` + - `src/apis/deprecated/` + - `src/components/deprecated/` + - `src/components/common/deprecated/` +- 삭제 후 `npm run build` 통과 및 dead import 0건 확인 + +## 🙋‍♂️ 담당자 + +- 프론트엔드: Cassiiopeia diff --git "a/docs/suh-template/issue/20260617_649_\354\247\210\353\254\270\354\203\201\354\204\270_API_\354\213\240\354\213\235\355\206\265\354\235\274.md" "b/docs/suh-template/issue/20260617_649_\354\247\210\353\254\270\354\203\201\354\204\270_API_\354\213\240\354\213\235\355\206\265\354\235\274.md" new file mode 100644 index 00000000..82fd5fff --- /dev/null +++ "b/docs/suh-template/issue/20260617_649_\354\247\210\353\254\270\354\203\201\354\204\270_API_\354\213\240\354\213\235\355\206\265\354\235\274.md" @@ -0,0 +1,31 @@ +## 📝 현재 문제점 + +API 통신 패턴이 신식(`apiUtils`의 `postApiRequest` 기반 `~PostApi` 객체형)과 구식(개별 default-export 함수, `apiClient.post` 직접 호출)으로 혼재되어 있습니다. + +대부분의 화면은 신식 패턴으로 이전되었으나, **질문 상세/답변/댓글 영역만 아직 구식 API**를 사용합니다. + +- `src/app/board/question/detail/[id]/page.tsx` → `@/apis/question/getQuestionDetails` (구식) +- `src/app/board/question/detail/[id]/answer/page.tsx` → `@/apis/question/postAnswer`, `getQuestionDetails` (구식) +- `src/app/board/question/detail/[id]/comment/page.tsx` → `@/apis/question/getQuestionDetails` (구식) +- `src/components/questionDetail/CommentInput.tsx` → `@/apis/question/postComment`, `refreshComments` (구식) +- `src/components/questionDetail/AnswerSection.tsx` → `@/apis/question/getAnswer` (구식) +- `src/components/questionDetail/ChaetaekCheckModal.tsx` → `@/apis/question/chaetaekAnswer` (구식) + +구식 함수는 자체 임시 타입을 쓰고 FormData를 수동 구성해, 타입 안정성과 일관성이 떨어집니다. + +## 🛠️ 해결 방안 / 제안 기능 + +⚙️ 작업 내용 +--- +- 질문 상세/답변/댓글의 모든 구식 API 호출을 신식 패턴으로 교체: + - `getQuestionDetails` → `questionPostApi.getQuestionPost` + - `getAnswer` / `postAnswer` → `questionPostApi` 답변 메서드 + - `chaetaekAnswer` → `questionPostApi` 채택 메서드 + - `postComment` / `refreshComments` → `commentApi` (신식) +- 백엔드 최신 엔드포인트와 정합성 확인 (BE: `/api/question/*`, `/api/comment/*` 멀티파트 기반) +- 교체 완료 후 `src/apis/question/*` 구식 파일 제거 +- `npm run build` 통과 및 질문 상세 플로우 동작 확인 + +## 🙋‍♂️ 담당자 + +- 프론트엔드: Cassiiopeia diff --git "a/docs/suh-template/issue/20260617_650_\354\212\244\355\203\200\354\235\274_\353\224\224\354\236\220\354\235\270\355\206\240\355\201\260_\355\206\265\354\235\274.md" "b/docs/suh-template/issue/20260617_650_\354\212\244\355\203\200\354\235\274_\353\224\224\354\236\220\354\235\270\355\206\240\355\201\260_\355\206\265\354\235\274.md" new file mode 100644 index 00000000..83e4e55b --- /dev/null +++ "b/docs/suh-template/issue/20260617_650_\354\212\244\355\203\200\354\235\274_\353\224\224\354\236\220\354\235\270\355\206\240\355\201\260_\355\206\265\354\235\274.md" @@ -0,0 +1,30 @@ +## 📝 현재 문제점 + +`tailwind.config.ts`에 디자인 토큰(document-main, question-main, ui-muted, ui-divider, ui-count, tag-yeopjeon 등)이 충실히 정의되어 있으나, 실제 컴포넌트는 하드코딩 값을 광범위하게 사용해 디자인 통일성이 무너져 있습니다. + +- **하드코딩 hex 색상** (`text-[#929292]`, `border-[#F1F1F1]`, `bg-[#CAFFE5]` 등): 약 184건 +- **인라인 `style={{}}`** (`style={{ color: "#00E271" }}` 등): 약 54개 파일 +- **임의 픽셀값** (`w-[336px]`, `h-[48px]`, `rounded-[34px]`, `p-[20px]` 등): 약 80건 +- **z-index 하드코딩** (`z-[100]`, `z-[80]`, `z-[70]` 등): 약 10개 파일, 중앙 관리 부재 + +CLAUDE.md의 스타일 규칙(Figma 값 직접 사용 금지, 디자인 토큰 필수)을 위반하는 상태입니다. + +## 🛠️ 해결 방안 / 제안 기능 + +⚙️ 작업 내용 +--- +- 하드코딩 hex 색상을 기존 디자인 토큰으로 기계적 매핑: + - `text-[#929292]`, `text-[#ACACAC]` → `text-ui-count` + - `border-[#F1F1F1]`, `#F0F0F0` → `border-ui-divider` + - `text-[#00E271]` → `text-question-main`, `bg-[#CAFFE5]` → `bg-tag-preset-question-bg` + - 토큰 미정의 색상은 `tailwind.config.ts`에 신규 토큰으로 추가 후 매핑 +- 인라인 `style={{}}` 제거 → Tailwind 클래스 / 조건부 클래스(clsx)로 전환 +- 임의 픽셀값을 Tailwind 표준 스케일 또는 상대값(`w-full`, `flex-1`, `max-w-[640px]`)으로 변환 +- z-index 중앙 관리(`src/global/zIndex.ts` 상수 또는 tailwind z 토큰) 도입 후 하드코딩 제거 +- 영역별 진행 (landing → documentDetail → questionPost/documentPost → 나머지) +- `npm run build` + `npx prettier --write .` 통과 + +## 🙋‍♂️ 담당자 + +- 프론트엔드: Cassiiopeia +- 디자인: Cassiiopeia diff --git "a/docs/suh-template/issue/20260617_651_common_\355\217\264\353\215\224_\352\265\254\354\241\260\354\240\225\353\246\254.md" "b/docs/suh-template/issue/20260617_651_common_\355\217\264\353\215\224_\352\265\254\354\241\260\354\240\225\353\246\254.md" new file mode 100644 index 00000000..2bb42f68 --- /dev/null +++ "b/docs/suh-template/issue/20260617_651_common_\355\217\264\353\215\224_\352\265\254\354\241\260\354\240\225\353\246\254.md" @@ -0,0 +1,26 @@ +## 📝 현재 문제점 + +`src/components/common/`은 "여러 영역에서 공유하는 진짜 공통 컴포넌트"를 담아야 하나, 실제로는 특정 도메인 전용 컴포넌트가 다수 섞여 있어 폴더 구조의 의미가 흐려졌습니다. + +- 도메인 전용인데 common에 위치한 컴포넌트 (약 13개): + - 자료: `DocumentCard`, `DocumentCommonInput`, `DocumentFilteringBottomSheet`, `MovingCardDocument` + - 질문: `QuestionCard`, `QuestionCommonInput`, `QuestionFilteringBottomSheet`, `ActiveQuestionFilters`, `MovingCardQuestion`, `BountySection` + - 공지: `MovingCardNotice`, `NoticeCard` +- 명명 일관성 부족: `CommonNav`(실제 document 전용), `ChaetaekCheckModal` vs `ChaetaekSuccessModal` 등 + +## 🛠️ 해결 방안 / 제안 기능 + +⚙️ 작업 내용 +--- +- 진짜 공통(`Card`, `SearchBar`, `LoadingSpinner`, 스켈레톤 등)만 `common/`에 유지 +- 도메인 전용 컴포넌트를 각 도메인 폴더로 이동: + - Document 계열 → `documentMain/` 또는 `documentDetail/` + - Question 계열 → `questionMain/` 또는 `questionDetail/` + - Notice 계열 → `notice/` +- 이동에 따른 import 경로 일괄 수정 +- 모호한 명명 정리 (예: `CommonNav` → 역할이 드러나는 이름) +- 구조 변경은 동작 변경 없이 진행, `npm run build` 통과로 회귀 없음 확인 + +## 🙋‍♂️ 담당자 + +- 프론트엔드: Cassiiopeia diff --git "a/docs/suh-template/issue/20260617_652_\354\232\264\354\230\201API_\352\262\200\354\246\235_QA.md" "b/docs/suh-template/issue/20260617_652_\354\232\264\354\230\201API_\352\262\200\354\246\235_QA.md" new file mode 100644 index 00000000..b1e4ea5e --- /dev/null +++ "b/docs/suh-template/issue/20260617_652_\354\232\264\354\230\201API_\352\262\200\354\246\235_QA.md" @@ -0,0 +1,23 @@ +## 📝 현재 문제점 + +대규모 레거시 제거·API 통일·스타일 통일·구조 정리 작업 이후, 회귀(regression) 없이 주요 사용자 플로우가 정상 동작하는지 검증이 필요합니다. + +- 백엔드 로컬 서버는 미기동 상태이나, 프론트 `appClient`의 baseURL이 운영 API(`https://api.sejong-malsami.co.kr`)로 설정되어 있어 운영 API 기준 검증이 가능합니다. + +## 🛠️ 해결 방안 / 제안 기능 + +⚙️ 작업 내용 +--- +- 테스트 계정으로 로그인 플로우 검증 +- 주요 플로우 동작 확인: + - 랜딩 → 자료게시판/질문게시판 진입 + - 자료 상세 / 질문 상세 (댓글·답변 영역 신식 API 동작) + - 게시글 작성 화면 렌더링 + - 검색, 마이페이지 +- 정적 검증: `npm run build` 성공, TypeScript 에러 0, `npx prettier --write .` 통과 +- 발견된 회귀/버그는 즉시 수정 후 재검증 + +## 🙋‍♂️ 담당자 + +- 프론트엔드: Cassiiopeia +- QA: Cassiiopeia diff --git a/package-lock.json b/package-lock.json index 3ac296d7..9057c9aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "malsami-fe", - "version": "0.1.0", + "version": "0.1.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "malsami-fe", - "version": "0.1.0", + "version": "0.1.26", "dependencies": { "@radix-ui/react-accordion": "^1.2.1", "@radix-ui/react-checkbox": "^1.1.2", diff --git a/src/app/board/question/detail/[id]/answer/page.tsx b/src/app/board/question/detail/[id]/answer/page.tsx index 3ffa3c3c..dca7402b 100644 --- a/src/app/board/question/detail/[id]/answer/page.tsx +++ b/src/app/board/question/detail/[id]/answer/page.tsx @@ -5,13 +5,13 @@ import { useParams, useRouter } from "next/navigation"; import axios from "axios"; import ScrollToTopOnLoad from "@/components/common/ScrollToTopOnLoad"; import LoadingSpinner from "@/components/common/LoadingSpinner"; -import postAnswer from "@/apis/question/postAnswer"; +import { answerPostApi } from "@/apis/answerPostApi"; import { useDispatch } from "react-redux"; import useCommonToast from "@/global/hook/useCommonToast"; import FileUploadInput from "@/components/questionPost/FileUploadInput"; import QuestionSummary from "@/components/questionComment/QuestionSummary"; import CommonHeader from "@/components/header/CommonHeader"; -import getQuestionDetails from "@/apis/question/getQuestionDetails"; +import { questionPostApi } from "@/apis/questionPostApi"; import { QuestionDto } from "@/types/api/responses/questionDto"; import { RIGHT_ITEM } from "@/types/header"; import CommonTextarea from "@/components/common/CommonTextarea"; @@ -102,7 +102,8 @@ export default function AnswerPostPage() { const fetchData = async () => { try { setIsQuestionsLoading(true); - const data = await getQuestionDetails(questionPostId); + // 신식 API 패턴(questionPostApi) 사용 + const data = await questionPostApi.getQuestionPost({ postId: questionPostId }); if (isMounted) { setQuestionDetails({ @@ -142,12 +143,13 @@ export default function AnswerPostPage() { if (isFormValid) { try { - await postAnswer({ + // 신식 API 패턴(answerPostApi) 사용 — 첨부파일은 attachmentFiles 키로 전송 + await answerPostApi.saveAnswerPost({ content: formData.content, questionPostId, isPrivate: formData.isPrivate, - mediaFiles: formData.mediaFiles, - }); // API 호출 + attachmentFiles: formData.mediaFiles, + }); showConfirmToast("답변이 성공적으로 등록되었습니다."); localStorage.removeItem("answerFormData"); // 로컬 스토리지의 임시저장 데이터 삭제 router.push(`/board/question/detail/${questionPostId}`); // 작성 완료 후 해당 질문 상세 페이지로 이동 diff --git a/src/app/board/question/detail/[id]/comment/page.tsx b/src/app/board/question/detail/[id]/comment/page.tsx index 7af12924..a786c2ce 100644 --- a/src/app/board/question/detail/[id]/comment/page.tsx +++ b/src/app/board/question/detail/[id]/comment/page.tsx @@ -4,7 +4,7 @@ import { useParams, useRouter } from "next/navigation"; import { useEffect, useState } from "react"; import CommonHeader from "@/components/header/CommonHeader"; -import getQuestionDetails from "@/apis/question/getQuestionDetails"; +import { questionPostApi } from "@/apis/questionPostApi"; import { QuestionDto } from "@/types/api/responses/questionDto"; import QuestionSummary from "@/components/questionComment/QuestionSummary"; import CommentList from "@/components/questionComment/CommentList"; @@ -32,7 +32,8 @@ export default function CommentPage() { const fetchData = async () => { try { setIsQuestionsLoading(true); - const data = await getQuestionDetails(postId); + // 신식 API 패턴(questionPostApi) 사용 + const data = await questionPostApi.getQuestionPost({ postId }); if (isMounted) { setQuestionDetails({ diff --git a/src/app/board/question/detail/[id]/page.tsx b/src/app/board/question/detail/[id]/page.tsx index d416ed22..cff94c31 100644 --- a/src/app/board/question/detail/[id]/page.tsx +++ b/src/app/board/question/detail/[id]/page.tsx @@ -5,7 +5,7 @@ import CommonHeader from "@/components/header/CommonHeader"; import { RIGHT_ITEM } from "@/types/header"; import { useParams, useRouter } from "next/navigation"; import { useEffect, useState, useRef } from "react"; -import getQuestionDetails from "@/apis/question/getQuestionDetails"; +import { questionPostApi } from "@/apis/questionPostApi"; import QuestionDetailSkeleton from "@/components/common/skeletons/QuestionDetailSkeleton"; import { isSameMemberById } from "@/global/memberUtil"; import QuestionDetail from "@/components/questionDetail/QuestionDetail"; @@ -50,7 +50,8 @@ export default function Page() { const fetchData = async () => { try { setIsLoading(true); // 로딩 상태 활성화 - const data = await getQuestionDetails(postId); + // 신식 API 패턴(questionPostApi) 사용 — postId를 Command로 전달 + const data = await questionPostApi.getQuestionPost({ postId }); if (isMounted) { // postId 설정 diff --git a/src/components/questionDetail/AnswerSection.tsx b/src/components/questionDetail/AnswerSection.tsx index d9ae3375..6b798d7d 100644 --- a/src/components/questionDetail/AnswerSection.tsx +++ b/src/components/questionDetail/AnswerSection.tsx @@ -3,7 +3,7 @@ import { useEffect, useState, useRef } from "react"; import Image from "next/image"; import { formatDateTime } from "@/global/time"; -import getAnswer from "@/apis/question/getAnswer"; +import { answerPostApi } from "@/apis/answerPostApi"; import likeApi from "@/apis/likeApi"; import { ContentType } from "@/types/api/constants/contentType"; import { LikeType } from "@/types/api/constants/likeType"; @@ -77,8 +77,9 @@ function AnswerSection({ postId, isAuthor, selectedAnswerId, onAnswerSelect }: A const fetchAnswers = async () => { try { setIsLoading(true); - const response = await getAnswer(postId); - setAnswers(Array.isArray(response) ? response : []); + // 신식 API 패턴(answerPostApi) 사용 — 응답 Dto에서 answerPosts 추출 + const response = await answerPostApi.getAnswersByQuestion({ questionPostId: postId }); + setAnswers(Array.isArray(response.answerPosts) ? response.answerPosts : []); } catch (fetchError) { console.error("답변 불러오기 실패:", fetchError); setLoadError("답변을 불러오는 중 오류가 발생했습니다."); diff --git a/src/components/questionDetail/ChaetaekCheckModal.tsx b/src/components/questionDetail/ChaetaekCheckModal.tsx index 373bb918..fa1bfe61 100644 --- a/src/components/questionDetail/ChaetaekCheckModal.tsx +++ b/src/components/questionDetail/ChaetaekCheckModal.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import chaetaekAnswer from "@/apis/question/chaetaekAnswer"; +import { answerPostApi } from "@/apis/answerPostApi"; import ChaetaekSuccessModal from "./ChaetaekSuccessModal"; interface ModalProps { @@ -14,8 +14,8 @@ function ChaetaekCheckModal({ isOpen, onClose, answerPostId, author }: ModalProp const handleConfirm = async () => { try { - const response = await chaetaekAnswer(answerPostId); - console.log("채택 성공:", response); + // 신식 API 패턴(answerPostApi) 사용 — 채택 대상 답변 PK를 postId로 전달 + await answerPostApi.chaetaekAnswerPost({ postId: answerPostId }); setIsSuccessModalOpen(true); } catch (error) { console.error("채택 요청 실패:", error); diff --git a/src/components/questionDetail/CommentInput.tsx b/src/components/questionDetail/CommentInput.tsx deleted file mode 100644 index 5f937392..00000000 --- a/src/components/questionDetail/CommentInput.tsx +++ /dev/null @@ -1,91 +0,0 @@ -/* eslint-disable jsx-a11y/no-static-element-interactions */ -/* eslint-disable jsx-a11y/click-events-have-key-events */ -import React, { useState } from "react"; -import { Input } from "@/components/shadcn/input"; -import { Checkbox } from "@/components/shadcn/checkbox"; -import Image from "next/image"; -import postComment from "@/apis/question/postComment"; -import refreshComments from "@/apis/question/refreshComments"; -import { Comment } from "@/types/api/entities/postgres/comment"; - -interface CommentInputProps { - postId: string; - contentType: "QUESTION" | "ANSWER" | "DOCUMENT" | "DOCUMENT_REQUEST"; - setComments: React.Dispatch>; // 댓글 목록 상태 - // eslint-disable-next-line react/require-default-props - setTotalComments?: React.Dispatch>; // 총 댓글 개수 상태 (선택) -} - -function CommentInput({ postId, contentType, setComments, setTotalComments }: CommentInputProps) { - const [content, setContent] = useState(""); // 입력한 댓글 내용 - const [isPrivate, setIsPrivate] = useState(false); // 익명 여부 - - // 댓글 입력값 변경 핸들러 - const handleInputChange = (e: React.ChangeEvent) => { - setContent(e.target.value); - }; - - // 익명 여부 체크박스 변경 핸들러 - const handleCheckboxChange = (checked: boolean | "indeterminate") => { - setIsPrivate(checked === true); - }; - - // 댓글 저장 및 새로고침 핸들러 - const handleSaveClick = async () => { - if (!content.trim()) { - alert("댓글 내용을 입력해주세요."); - return; - } - - try { - // 댓글 등록 API 호출 - await postComment({ - content, - postId, - contentType, - isPrivate, - }); - console.log("댓글 등록 성공"); - - // 댓글 입력란 초기화 - setContent(""); - - // 댓글 새로고침 (페이지네이션 기본값 명시) - await refreshComments({ - postId, - contentType, - setComments, - setTotalComments, - pageNumber: 0, // 첫 페이지로 설정 - pageSize: 30, // 기본 페이지 크기 설정 - }); - } catch (error) { - console.error("Error posting comment:", error); - } - }; - - return ( -
-
- -
-
-
- -

익명

-
-
- Save -
-
-
- ); -} - -export default CommentInput; From 0743cf5915355cb2e1fefc232dcaab676ced22e7 Mon Sep 17 00:00:00 2001 From: SUH SAECHAN <83532821+Cassiiopeia@users.noreply.github.com> Date: Wed, 17 Jun 2026 00:24:37 +0900 Subject: [PATCH 05/88] =?UTF-8?q?=EB=A0=88=EA=B1=B0=EC=8B=9C=20deprecated?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=A0=84=EB=A9=B4=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=20:=20refactor=20:=20deprecated=20=ED=8F=B4=EB=8D=94=20109?= =?UTF-8?q?=EA=B0=9C=20=EC=82=AD=EC=A0=9C,=20DocDetail=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=C2=B7TierBoard=20=ED=97=A4=EB=8D=94=20=EC=8B=A0?= =?UTF-8?q?=EC=8B=9D=20=EA=B5=90=EC=B2=B4,=20DocumentType=20=EB=AF=B8impor?= =?UTF-8?q?t=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20https://github.co?= =?UTF-8?q?m/Sejong-Balsamic/Malsami-FE/issues/648?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/deprecated/postNewDoc.ts | 70 ---- src/apis/deprecated/postNewQna.ts | 74 ---- src/apis/document/fileDownload.ts | 36 -- src/apis/document/getDocumentDetails.ts | 26 -- src/apis/document/getFilteringDocs.ts | 47 --- src/apis/document/getHotDownloadDocs.ts | 25 -- src/apis/document/getMyShortInfo.ts | 21 - src/apis/document/getRequestDocs.ts | 51 --- src/apis/document/postLikeDocument.ts | 46 --- src/apis/question/chaetaekAnswer.ts | 24 -- src/apis/question/getAnswer.ts | 24 -- src/apis/question/getCategoryQNAs.ts | 65 --- src/apis/question/getComments.ts | 31 -- src/apis/question/getFaculties.ts | 22 - src/apis/question/getQuestionDetails.ts | 26 -- src/apis/question/getUnansweredQNAs.ts | 32 -- src/apis/question/postAnswer.ts | 40 -- src/apis/question/postComment.ts | 32 -- src/apis/question/postLikeComment.ts | 28 -- src/apis/question/postLikeQuestion.ts | 31 -- src/apis/question/refreshComments.ts | 34 -- src/apis/search/getSearchResult.ts | 22 - .../common/deprecated/AnswerInput.tsx | 29 -- .../common/deprecated/CategoryCardList.tsx | 40 -- .../common/deprecated/DailyPopularContent.tsx | 58 --- .../common/deprecated/DocMainCard.tsx | 21 - .../common/deprecated/DocPopularContainer.tsx | 113 ------ .../common/deprecated/HotDownloadSection.tsx | 55 --- .../common/deprecated/MovingCardDocument.tsx | 88 ---- .../common/deprecated/OriginalQuestion.tsx | 85 ---- .../common/deprecated/QnaFilterControlBar.tsx | 102 ----- .../deprecated/QnaFilterFacultyCategory.tsx | 123 ------ .../deprecated/QnaFilterOptionsModal.tsx | 205 ---------- .../common/deprecated/QnaMovingCard.tsx | 82 ---- .../deprecated/QnaSelectFacultyModal.tsx | 108 ----- .../common/deprecated/ToggleSwitch.tsx | 27 -- .../deprecated/WeeklyPopularContent.tsx | 48 --- .../deprecated/LoginDirectModal.tsx | 46 --- src/components/documentDetail/DocDetail.tsx | 4 +- .../documentDetail/DocumentCommentSection.tsx | 155 +++++++ src/components/documentMain/TierBoard.tsx | 56 +-- src/deprecated/AllDocument.tsx | 64 --- src/deprecated/AllQuestion.tsx | 64 --- src/deprecated/AnswerPageNav.tsx | 24 -- src/deprecated/ChaeTaekTag.tsx | 11 - src/deprecated/CommonMainSearchBar.tsx | 155 ------- src/deprecated/CommonSearchBar.tsx | 134 ------- src/deprecated/DCommentSection.tsx | 195 --------- src/deprecated/DDetailNav.tsx | 63 --- src/deprecated/DocJiJeongTag.tsx | 5 - src/deprecated/DocMainPageNav.tsx | 26 -- src/deprecated/DocPostCategoryTagsModal.tsx | 71 ---- src/deprecated/DocPostNav.tsx | 35 -- src/deprecated/DocPostStudyYearModal.tsx | 90 ----- src/deprecated/DocTierPageNav.tsx | 30 -- src/deprecated/FlyingBooks.tsx | 379 ------------------ src/deprecated/HotDocument.tsx | 96 ----- src/deprecated/HotQuestion.tsx | 108 ----- src/deprecated/JiJeongTag.tsx | 47 --- src/deprecated/LandingApiResponse.ts | 0 src/deprecated/LandingNav.tsx | 198 --------- src/deprecated/LandingSearchBar.tsx | 183 --------- src/deprecated/MovingCardDocument.tsx | 85 ---- src/deprecated/MyPageDetailNav.tsx | 28 -- src/deprecated/MyPageNav.tsx | 28 -- src/deprecated/NoticeHelpNav.tsx | 28 -- src/deprecated/PrivateSettingInput.tsx | 37 -- src/deprecated/QDetailNav.tsx | 53 --- src/deprecated/QnaPageNav.tsx | 24 -- src/deprecated/QnaPostNav.tsx | 35 -- src/deprecated/QuestionDetailData.ts | 42 -- src/deprecated/SearchBar.tsx | 74 ---- src/deprecated/SearchComponent.tsx | 45 --- src/deprecated/SearchInput.tsx | 77 ---- src/deprecated/SearchPageInput.tsx | 116 ------ src/deprecated/SubjectTag.tsx | 9 - src/deprecated/YeopjeonTag.tsx | 13 - src/deprecated/answer.ts | 34 -- src/deprecated/answerPost.ts | 0 src/deprecated/auth.ts | 30 -- src/deprecated/comment.ts | 45 --- .../components/questionDetail/AnswerFAB.tsx | 35 -- src/deprecated/components/shadcn/toast.tsx | 158 -------- src/deprecated/components/shadcn/toaster.tsx | 53 --- src/deprecated/document.ts | 136 ------- src/deprecated/fetchHot.ts | 98 ----- src/deprecated/getAccessInfo.ts | 20 - src/deprecated/getAllDocument.ts | 22 - src/deprecated/getAllQuestion.ts | 22 - src/deprecated/getDocDailyPopulars.ts | 24 -- src/deprecated/getDocHotDownload.ts | 19 - src/deprecated/getDocMyFaculty.ts | 23 -- src/deprecated/getDocRequest.ts | 19 - src/deprecated/getDocWeeklyPopulars.ts | 25 -- src/deprecated/getMyInfo.ts | 22 - src/deprecated/getMyPage.ts | 22 - src/deprecated/global/hook/useToast.ts | 202 ---------- src/deprecated/global/toastUtils.ts | 31 -- src/deprecated/logOut.ts | 23 -- src/deprecated/question.ts | 110 ----- src/deprecated/questionPost.ts | 0 .../questionPost/CustomTagsInput.tsx | 29 -- .../questionPost/JijeongTagInput.tsx | 28 -- .../questionPost/QnaPostCustomTagsModal.tsx | 105 ----- .../questionPost/QnaPostJiJeongTagModal.tsx | 54 --- .../questionPost/QnaPostRewardModal.tsx | 76 ---- .../questionPost/QnaPostSubjectModal.tsx | 42 -- .../SubjectSearchInputComponent.tsx | 18 - .../questionPost/YeopjeonRewardInput.tsx | 15 - src/deprecated/questionPostsPage.ts | 0 src/deprecated/refresh.ts | 29 -- src/deprecated/studyYearInput.tsx | 15 - src/types/api/requests/documentCommand.ts | 1 + 113 files changed, 180 insertions(+), 6329 deletions(-) delete mode 100644 src/apis/deprecated/postNewDoc.ts delete mode 100644 src/apis/deprecated/postNewQna.ts delete mode 100644 src/apis/document/fileDownload.ts delete mode 100644 src/apis/document/getDocumentDetails.ts delete mode 100644 src/apis/document/getFilteringDocs.ts delete mode 100644 src/apis/document/getHotDownloadDocs.ts delete mode 100644 src/apis/document/getMyShortInfo.ts delete mode 100644 src/apis/document/getRequestDocs.ts delete mode 100644 src/apis/document/postLikeDocument.ts delete mode 100644 src/apis/question/chaetaekAnswer.ts delete mode 100644 src/apis/question/getAnswer.ts delete mode 100644 src/apis/question/getCategoryQNAs.ts delete mode 100644 src/apis/question/getComments.ts delete mode 100644 src/apis/question/getFaculties.ts delete mode 100644 src/apis/question/getQuestionDetails.ts delete mode 100644 src/apis/question/getUnansweredQNAs.ts delete mode 100644 src/apis/question/postAnswer.ts delete mode 100644 src/apis/question/postComment.ts delete mode 100644 src/apis/question/postLikeComment.ts delete mode 100644 src/apis/question/postLikeQuestion.ts delete mode 100644 src/apis/question/refreshComments.ts delete mode 100644 src/apis/search/getSearchResult.ts delete mode 100644 src/components/common/deprecated/AnswerInput.tsx delete mode 100644 src/components/common/deprecated/CategoryCardList.tsx delete mode 100644 src/components/common/deprecated/DailyPopularContent.tsx delete mode 100644 src/components/common/deprecated/DocMainCard.tsx delete mode 100644 src/components/common/deprecated/DocPopularContainer.tsx delete mode 100644 src/components/common/deprecated/HotDownloadSection.tsx delete mode 100644 src/components/common/deprecated/MovingCardDocument.tsx delete mode 100644 src/components/common/deprecated/OriginalQuestion.tsx delete mode 100644 src/components/common/deprecated/QnaFilterControlBar.tsx delete mode 100644 src/components/common/deprecated/QnaFilterFacultyCategory.tsx delete mode 100644 src/components/common/deprecated/QnaFilterOptionsModal.tsx delete mode 100644 src/components/common/deprecated/QnaMovingCard.tsx delete mode 100644 src/components/common/deprecated/QnaSelectFacultyModal.tsx delete mode 100644 src/components/common/deprecated/ToggleSwitch.tsx delete mode 100644 src/components/common/deprecated/WeeklyPopularContent.tsx delete mode 100644 src/components/deprecated/LoginDirectModal.tsx create mode 100644 src/components/documentDetail/DocumentCommentSection.tsx delete mode 100644 src/deprecated/AllDocument.tsx delete mode 100644 src/deprecated/AllQuestion.tsx delete mode 100644 src/deprecated/AnswerPageNav.tsx delete mode 100644 src/deprecated/ChaeTaekTag.tsx delete mode 100644 src/deprecated/CommonMainSearchBar.tsx delete mode 100644 src/deprecated/CommonSearchBar.tsx delete mode 100644 src/deprecated/DCommentSection.tsx delete mode 100644 src/deprecated/DDetailNav.tsx delete mode 100644 src/deprecated/DocJiJeongTag.tsx delete mode 100644 src/deprecated/DocMainPageNav.tsx delete mode 100644 src/deprecated/DocPostCategoryTagsModal.tsx delete mode 100644 src/deprecated/DocPostNav.tsx delete mode 100644 src/deprecated/DocPostStudyYearModal.tsx delete mode 100644 src/deprecated/DocTierPageNav.tsx delete mode 100644 src/deprecated/FlyingBooks.tsx delete mode 100644 src/deprecated/HotDocument.tsx delete mode 100644 src/deprecated/HotQuestion.tsx delete mode 100644 src/deprecated/JiJeongTag.tsx delete mode 100644 src/deprecated/LandingApiResponse.ts delete mode 100644 src/deprecated/LandingNav.tsx delete mode 100644 src/deprecated/LandingSearchBar.tsx delete mode 100644 src/deprecated/MovingCardDocument.tsx delete mode 100644 src/deprecated/MyPageDetailNav.tsx delete mode 100644 src/deprecated/MyPageNav.tsx delete mode 100644 src/deprecated/NoticeHelpNav.tsx delete mode 100644 src/deprecated/PrivateSettingInput.tsx delete mode 100644 src/deprecated/QDetailNav.tsx delete mode 100644 src/deprecated/QnaPageNav.tsx delete mode 100644 src/deprecated/QnaPostNav.tsx delete mode 100644 src/deprecated/QuestionDetailData.ts delete mode 100644 src/deprecated/SearchBar.tsx delete mode 100644 src/deprecated/SearchComponent.tsx delete mode 100644 src/deprecated/SearchInput.tsx delete mode 100644 src/deprecated/SearchPageInput.tsx delete mode 100644 src/deprecated/SubjectTag.tsx delete mode 100644 src/deprecated/YeopjeonTag.tsx delete mode 100644 src/deprecated/answer.ts delete mode 100644 src/deprecated/answerPost.ts delete mode 100644 src/deprecated/auth.ts delete mode 100644 src/deprecated/comment.ts delete mode 100644 src/deprecated/components/questionDetail/AnswerFAB.tsx delete mode 100644 src/deprecated/components/shadcn/toast.tsx delete mode 100644 src/deprecated/components/shadcn/toaster.tsx delete mode 100644 src/deprecated/document.ts delete mode 100644 src/deprecated/fetchHot.ts delete mode 100644 src/deprecated/getAccessInfo.ts delete mode 100644 src/deprecated/getAllDocument.ts delete mode 100644 src/deprecated/getAllQuestion.ts delete mode 100644 src/deprecated/getDocDailyPopulars.ts delete mode 100644 src/deprecated/getDocHotDownload.ts delete mode 100644 src/deprecated/getDocMyFaculty.ts delete mode 100644 src/deprecated/getDocRequest.ts delete mode 100644 src/deprecated/getDocWeeklyPopulars.ts delete mode 100644 src/deprecated/getMyInfo.ts delete mode 100644 src/deprecated/getMyPage.ts delete mode 100644 src/deprecated/global/hook/useToast.ts delete mode 100644 src/deprecated/global/toastUtils.ts delete mode 100644 src/deprecated/logOut.ts delete mode 100644 src/deprecated/question.ts delete mode 100644 src/deprecated/questionPost.ts delete mode 100644 src/deprecated/questionPost/CustomTagsInput.tsx delete mode 100644 src/deprecated/questionPost/JijeongTagInput.tsx delete mode 100644 src/deprecated/questionPost/QnaPostCustomTagsModal.tsx delete mode 100644 src/deprecated/questionPost/QnaPostJiJeongTagModal.tsx delete mode 100644 src/deprecated/questionPost/QnaPostRewardModal.tsx delete mode 100644 src/deprecated/questionPost/QnaPostSubjectModal.tsx delete mode 100644 src/deprecated/questionPost/SubjectSearchInputComponent.tsx delete mode 100644 src/deprecated/questionPost/YeopjeonRewardInput.tsx delete mode 100644 src/deprecated/questionPostsPage.ts delete mode 100644 src/deprecated/refresh.ts delete mode 100644 src/deprecated/studyYearInput.tsx diff --git a/src/apis/deprecated/postNewDoc.ts b/src/apis/deprecated/postNewDoc.ts deleted file mode 100644 index c6bd1c58..00000000 --- a/src/apis/deprecated/postNewDoc.ts +++ /dev/null @@ -1,70 +0,0 @@ -// // src/apis/questionBoard/postNewQna.ts -// import { apiClient } from "../appClient"; - -// interface DocPostFormData { -// title: string; // 필수 -// content: string; // 필수 -// subject: string; // 필수 -// categoryTags: string[]; // 필수 -// customTags: string[]; -// studyYear: number; -// isPrivate: boolean; -// mediaFiles: File[]; // File 배열로 정의 -// } - -// export default async function postNewDoc(data: DocPostFormData) { -// const formData = new FormData(); - -// const tagMapping: { [key: string]: string } = { -// 강의자료: "DOCUMENT", -// "과제 기출": "PAST_EXAM", -// 해설: "SOLUTION", -// }; - -// // 필수 항목 추가 -// formData.append("title", data.title); -// formData.append("content", data.content); -// formData.append("subject", data.subject); - -// // 선택 항목 추가 -// if (data.studyYear) { -// formData.append("attendedYear", data.studyYear.toString()); -// } -// if (data.isPrivate !== undefined) { -// formData.append("isDepartmentPrivate", data.isPrivate.toString()); -// } - -// // 카테고리 -// if (data.categoryTags && data.categoryTags.length > 0) { -// data.categoryTags.forEach(tag => { -// const englishTag = tagMapping[tag]; // 한국어 태그를 영어로 변환 -// if (englishTag) formData.append("documentTypes", englishTag); -// }); -// } - -// // 커스텀 태그 -// if (data.customTags && data.customTags.length > 0) { -// data.customTags.forEach(tag => { -// formData.append("customTags", tag); -// }); -// } - -// // 첨부 파일 -// if (data.mediaFiles && data.mediaFiles.length > 0) { -// data.mediaFiles.forEach(file => { -// formData.append("attachmentFiles", file); -// }); -// } - -// try { -// const response = await apiClient.post("/api/document/post", formData, { -// headers: { -// "Content-Type": "multipart/form-data", -// }, -// }); -// return response.data; -// } catch (error) { -// console.log("Q&A 게시글 등록 중 오류 발생:", error); -// throw error; -// } -// } diff --git a/src/apis/deprecated/postNewQna.ts b/src/apis/deprecated/postNewQna.ts deleted file mode 100644 index 35a68107..00000000 --- a/src/apis/deprecated/postNewQna.ts +++ /dev/null @@ -1,74 +0,0 @@ -// // src/apis/questionBoard/postNewQna.ts -// import { apiClient } from "../appClient"; - -// interface QnaPostFormData { -// title: string; -// content: string; -// subject: string; -// customTags?: string[]; -// questionPresetTags?: string[]; -// reward?: number; -// isPrivate?: boolean; -// mediaFiles?: File[]; -// } - -// export default async function postNewQna(data: QnaPostFormData) { -// const formData = new FormData(); - -// const tagMapping: { [key: string]: string } = { -// "수업 외 내용": "OUT_OF_CLASS", -// "개념 모름": "UNKNOWN_CONCEPT", -// "더 나은 풀이": "BETTER_SOLUTION", -// "시험 대비": "EXAM_PREPARATION", -// "자료 요청": "DOCUMENT_REQUEST", -// "공부 팁": "STUDY_TIPS", -// "조언 구함": "ADVICE_REQUEST", -// }; - -// // 필수 항목 추가 -// formData.append("title", data.title); -// formData.append("content", data.content); -// formData.append("subject", data.subject); - -// // 선택 항목 추가 -// if (data.reward !== undefined) { -// formData.append("rewardYeopjeon", data.reward.toString()); -// } -// if (data.isPrivate !== undefined) { -// formData.append("isPrivate", data.isPrivate.toString()); -// } - -// // 정적 태그 -// if (data.questionPresetTags && data.questionPresetTags.length > 0) { -// data.questionPresetTags.forEach(tag => { -// const englishTag = tagMapping[tag]; // 한국어 태그를 영어로 변환 -// if (englishTag) formData.append("questionPresetTags", englishTag); -// }); -// } - -// // 커스텀 태그 -// if (data.customTags && data.customTags.length > 0) { -// data.customTags.forEach(tag => { -// formData.append("customTags", tag); -// }); -// } - -// // 첨부 파일 -// if (data.mediaFiles && data.mediaFiles.length > 0) { -// data.mediaFiles.forEach(file => { -// formData.append("attachmentFiles", file); -// }); -// } - -// try { -// const response = await apiClient.post("/api/question/post", formData, { -// headers: { -// "Content-Type": "multipart/form-data", -// }, -// }); -// return response.data; -// } catch (error) { -// console.log("Q&A 게시글 등록 중 오류 발생:", error); -// throw error; -// } -// } diff --git a/src/apis/document/fileDownload.ts b/src/apis/document/fileDownload.ts deleted file mode 100644 index 1c3d0af7..00000000 --- a/src/apis/document/fileDownload.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { apiClient } from "../appClient"; - -// 자료 파일 다운로드 함수 -export default async function fileDownload(documentFileId: string, originalFileName: string): Promise { - try { - // FormData 생성 - const formData = new FormData(); - formData.append("documentFileId", documentFileId); - - // POST 요청으로 파일 다운로드 - const response = await apiClient.post("/api/document/file/download", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - responseType: "arraybuffer", // 파일 데이터는 바이너리로 수신 - }); - - // Blob 데이터 생성 - const blob = new Blob([response.data], { type: response.headers["content-type"] }); - - // Blob URL 생성 및 다운로드 트리거 - const blobURL = window.URL.createObjectURL(blob); - const a = document.createElement("a"); - a.href = blobURL; - a.download = originalFileName; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - - // Blob URL 해제 - window.URL.revokeObjectURL(blobURL); - } catch (error) { - console.error("파일 다운로드 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/document/getDocumentDetails.ts b/src/apis/document/getDocumentDetails.ts deleted file mode 100644 index c8a69b80..00000000 --- a/src/apis/document/getDocumentDetails.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DocumentData } from "@/types/DocumentDetailData"; -import { apiClient } from "../appClient"; - -// 특정 문서 글을 조회하는 함수 -export default async function getDocumentDetails(documentPostId: string): Promise { - try { - // `FormData` 객체를 생성해 `postId` 추가 - const formData = new FormData(); - formData.append("documentPostId", documentPostId); - - // 특정 문서 글을 조회하기 위한 POST 요청을 보냄 (multipart/form-data 사용) - const response = await apiClient.post("/api/document/get", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - - console.log("Response Data:", response); // Add this line to inspect the API response - // 응답 데이터를 반환 - return response.data; - } catch (error) { - // 오류 발생 시 콘솔에 에러를 출력 - console.error("문서 조회 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/document/getFilteringDocs.ts b/src/apis/document/getFilteringDocs.ts deleted file mode 100644 index 5db64330..00000000 --- a/src/apis/document/getFilteringDocs.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { apiClient } from "@/apis/appClient"; -import { DocTypesKey } from "@/types/docTypes"; -import { PostTiersKey } from "@/types/postTiers"; -import { SortType } from "@/types/api/constants/sortType"; - -interface FilteringDocListParams { - subject?: string; // 교과목명 (선택) - docTypes?: DocTypesKey[]; // 태그 필터링 (최대 2개, 선택) - faculty?: string; // 단과대 필터링 (선택) - postTier?: PostTiersKey; // 자료 등급별 필터링 (선택) - sortType?: SortType; // 정렬 기준 (default = 최신순) - pageNumber?: number; // 페이지 번호 (default = 0) - pageSize?: number; // 한 페이지 조회 글 개수 (default = 30) -} - -export default async function getFilteringDocs(params: FilteringDocListParams) { - const formData = new FormData(); - - // 기본 필수 파라미터 설정 - formData.append("pageNumber", (params.pageNumber ?? 0).toString()); // 페이지 번호 - formData.append("pageSize", (params.pageSize ?? 15).toString()); // 페이지 크기 - - // 선택적 파라미터 설정 - // null과 undefined를 빈 문자열로 처리하는 기본값을 설정하기 위해 삼항 연산자, 널 병합 연산자 사용 - formData.append("subject", params.subject ?? ""); // 교과목명 - if (params.docTypes?.length) { - params.docTypes.forEach(docType => { - formData.append("documentTypes", docType); - }); - } - formData.append("faculty", params.faculty ?? ""); // 단과대 - formData.append("postTier", params.postTier ?? ""); // 자료 등급별 - formData.append("sortType", params.sortType ?? ""); // 정렬 기준 - - // API 호출 - try { - const response = await apiClient.post("/api/document/filter", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - return response.data.documentPostsPage; // API 호출 결과만 반환 - } catch (error) { - console.error("내 전공 관련 자료 목록을 가져오는 중 오류 발생:", error); - throw error; // 오류 발생 시 오류를 그대로 throw - } -} diff --git a/src/apis/document/getHotDownloadDocs.ts b/src/apis/document/getHotDownloadDocs.ts deleted file mode 100644 index 8e8b4dd0..00000000 --- a/src/apis/document/getHotDownloadDocs.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { apiClient } from "@/apis/appClient"; - -interface FilteringDocListParams { - pageNumber?: number; // 페이지 번호 (default = 0) - pageSize?: number; // 한 페이지 조회 글 개수 (default = 30) -} - -export default async function getHotDownloadDocs(params: FilteringDocListParams) { - try { - const formData = new FormData(); - - formData.append("pageNumber", (params.pageNumber ?? 0).toString()); // 페이지 번호 - formData.append("pageSize", (params.pageSize ?? 15).toString()); // 페이지 크기 - - const response = await apiClient.post("/api/document/hot-download", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - return response.data.documentPostsPage; // API 호출 결과만 반환 - } catch (error) { - console.error("내 전공 관련 자료 목록을 가져오는 중 오류 발생:", error); - throw error; // 오류 발생 시 오류를 그대로 throw - } -} diff --git a/src/apis/document/getMyShortInfo.ts b/src/apis/document/getMyShortInfo.ts deleted file mode 100644 index 7157951a..00000000 --- a/src/apis/document/getMyShortInfo.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { apiClient } from "@/apis/appClient"; - -export default async function getMyShortInfo() { - try { - // FormData 객체 생성 - const formData = new FormData(); - - // POST 요청으로 회원 정보 조회 - const response = await apiClient.post("/api/member/my-info", formData, { - headers: { - "Content-Type": "multipart/form-data", // Content-Type 설정 - // Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`, // JWT 토큰 설정 - }, - }); - - return response.data; // 서버로부터 반환된 데이터 - } catch (error) { - console.error("회원 정보 가져오기 실패:", error); - throw error; - } -} diff --git a/src/apis/document/getRequestDocs.ts b/src/apis/document/getRequestDocs.ts deleted file mode 100644 index 1d1673ab..00000000 --- a/src/apis/document/getRequestDocs.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { apiClient } from "@/apis/appClient"; - -interface FilteringDocListParams { - documentTypes?: string[]; // 태그 필터링 (최대 2개, 선택) - faculty?: string; // 단과대 필터링 (선택) - sortType?: string; // 정렬 기준 (default = 최신순) - pageNumber?: number; // 페이지 번호 (default = 0) - pageSize?: number; // 한 페이지 조회 글 개수 (default = 30) -} - -export default async function getRequestDocs(params: FilteringDocListParams) { - // 한국어 -> 영어 매핑 객체 - const sortOptionMapping: { [key: string]: string } = { - 최근순: "LATEST", - "좋아요 많은 순": "MOST_LIKED", - "조회수 높은 순": "VIEW_COUNT", - }; - - const tagMapping: { [key: string]: string } = { - "강의 자료": "DOCUMENT", - "과제 기출": "PAST_EXAM", - 해설: "SOLUTION", - }; - - try { - const formData = new FormData(); - if (params.documentTypes?.length) { - params.documentTypes.forEach(tag => { - const mappedTag = tagMapping[tag]; // 배열의 각 값에 대해 매핑 - if (mappedTag) { - formData.append("documentTypes", mappedTag); - } - }); - } - if (params.faculty) formData.append("faculty", params.faculty); // 단과대 - if (params.sortType) formData.append("sortType", sortOptionMapping[params.sortType]); // 정렬 기준 - - formData.append("pageNumber", (params.pageNumber ?? 0).toString()); // 페이지 번호 - formData.append("pageSize", (params.pageSize ?? 15).toString()); // 페이지 크기 - - const response = await apiClient.post("/api/document-request/filter", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - return response.data.documentRequestPostsPage; // API 호출 결과만 반환 - } catch (error) { - console.error("내 전공 관련 자료 목록을 가져오는 중 오류 발생:", error); - throw error; // 오류 발생 시 오류를 그대로 throw - } -} diff --git a/src/apis/document/postLikeDocument.ts b/src/apis/document/postLikeDocument.ts deleted file mode 100644 index ce344c93..00000000 --- a/src/apis/document/postLikeDocument.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { apiClient } from "../appClient"; - -interface LikeResponse { - documentPost: { - likeCount: number; - dislikeCount: number; - }; - documentBoardLike: { - createdDate: string; - updatedDate: string; - documentBoardLikeId: string; - memberId: string; - documentBoardId: string; - contentType: string; - reactionType: string; - }; -} - -// 특정 자료글 또는 자료 요청글에 좋아요/싫어요를 누르는 함수 -export default async function postLikeDocument( - documentPostId: string, - contentType: "DOCUMENT" | "DOCUMENT_REQUEST", - likeType: "LIKE" | "DISLIKE", -): Promise { - try { - // FormData 객체 생성 및 데이터 추가 - const formData = new FormData(); - formData.append("documentPostId", documentPostId); - formData.append("contentType", contentType); - formData.append("likeType", likeType); - - // 좋아요/싫어요를 위한 POST 요청 - const response = await apiClient.post("/api/likes/document/board", formData, { - headers: { - "Content-Type": "multipart/form-data", // Content-Type 설정 - }, - }); - - // 응답 데이터 반환 - return response.data; - } catch (error) { - // 오류 발생 시 에러 출력 - console.error("좋아요/싫어요 처리 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/chaetaekAnswer.ts b/src/apis/question/chaetaekAnswer.ts deleted file mode 100644 index b3efbc3d..00000000 --- a/src/apis/question/chaetaekAnswer.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { QuestionDto } from "@/types/api/responses/questionDto"; -import { apiClient } from "../appClient"; - -export default async function chaetaekAnswer(postId: string): Promise { - try { - // 요청 데이터를 FormData로 생성 - const formData = new FormData(); - formData.append("postId", postId); - - // 채택 요청 - const response = await apiClient.post("/api/question/answer/chaetaek", formData, { - headers: { - "Content-Type": "multipart/form-data", // Content-Type 설정 - }, - }); - - // 응답 데이터 반환 - return response.data; - } catch (error) { - // 오류 발생 시 처리 - console.error("답변 채택 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/getAnswer.ts b/src/apis/question/getAnswer.ts deleted file mode 100644 index 891067db..00000000 --- a/src/apis/question/getAnswer.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { AnswerPost } from "@/types/api/entities/postgres/answerPost"; -import { QuestionDto } from "@/types/api/responses/questionDto"; -import { apiClient } from "../appClient"; - -// 특정 질문 글에 작성된 답변 조회 -export default async function getAnswer(questionPostId: string): Promise { - try { - // FormData 객체 생성 및 데이터 추가 - const formData = new FormData(); - formData.append("questionPostId", questionPostId); - - // POST 요청으로 답변 리스트 조회 - const response = await apiClient.post("/api/question/answer/get/all", formData, { - headers: { - "Content-Type": "multipart/form-data", // Content-Type 설정 - }, - }); - - return response.data.answerPosts; - } catch (error) { - console.error("답변 조회 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/getCategoryQNAs.ts b/src/apis/question/getCategoryQNAs.ts deleted file mode 100644 index 8317c938..00000000 --- a/src/apis/question/getCategoryQNAs.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { ChaetaekStatusKey } from "@/types/chaetaekStatus"; -import { QnaPresetTagsKey } from "@/types/qnaPresetTags"; -import { SortType } from "@/types/api/constants/sortType"; -import { apiClient } from "../appClient"; - -interface GetCategoryQnasProps { - subject?: string; // 교과목명 필터링 - minYeopjeon?: number; // 엽전 현상금 최소 개수 - maxYeopjeon?: number; // 엽전 현상금 최대 개수 - qnaPresetTags?: QnaPresetTagsKey[]; // 정적 태그 필터링 - chaetaekStatus?: ChaetaekStatusKey; // 채택여부 필터링 - sortType?: SortType; // 정렬 조건 - faculty?: string; // 단과대 필터링 (REDUX: selectedFacultyMapByBoard["question"]의 value) - isAllFacultySelected?: boolean; // 단고대가 "전체"로 선택된 여부 - pageNumber?: number; // 조회하고 싶은 페이지 번호 (기본값 0) - pageSize?: number; // 한 페이지에 조회하고 싶은 글 개수 (기본값 30) -} - -export default async function getCategoryQNAs(params: GetCategoryQnasProps) { - const formData = new FormData(); - - // 기본 필수 파라미터 설정 - formData.append("subject", ""); - formData.append("pageNumber", (params.pageNumber ?? 0).toString()); - formData.append("pageSize", (params.pageSize ?? 15).toString()); - - // 선택적 파라미터 추가 - // null과 undefined를 빈 문자열로 처리하는 기본값을 설정하기 위해 삼항 연산자를 사용 - if (params.qnaPresetTags && params.qnaPresetTags.length > 0) { - params.qnaPresetTags.forEach(qnaPresetTag => { - formData.append("questionPresetTags", qnaPresetTag); - }); - } else formData.append("questionPresetTags", ""); - // 단과대 필터 분기문 - if (params.isAllFacultySelected) { - // "전체"를 선택한 경우 - formData.append("faculty", ""); - } else { - // "전체"를 선택하지 않은 경우 - // eslint-disable-next-line no-lonely-if - if (params.faculty) { - // 단과대를 선택한 경우 - formData.append("faculty", params.faculty); - } else { - // 단과대를 선택하지 않은 경우 ("전체" 로 판단) - formData.append("faculty", ""); - } - } - formData.append("chaetaekStatus", params.chaetaekStatus ?? ""); - formData.append("sortType", params.sortType ?? ""); - - // API 호출 - try { - const response = await apiClient.post("/api/question/filter", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - // API 호출 결과만 반환 - return response.data.questionPostsPage; - } catch (error) { - console.error("질문 목록을 가져오는 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/getComments.ts b/src/apis/question/getComments.ts deleted file mode 100644 index b3f61ac2..00000000 --- a/src/apis/question/getComments.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { apiClient } from "../appClient"; - -interface GetCommentsParams { - postId: string; - contentType: "QUESTION" | "ANSWER" | "DOCUMENT" | "DOCUMENT_REQUEST"; - pageNumber?: number; - pageSize?: number; -} - -const getComments = async ({ postId, contentType, pageNumber = 0, pageSize = 30 }: GetCommentsParams) => { - try { - const formData = new FormData(); - formData.append("postId", postId); - formData.append("contentType", contentType); - formData.append("pageNumber", pageNumber.toString()); - formData.append("pageSize", pageSize.toString()); - - const response = await apiClient.post("/api/comment/get/all", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - - return response.data; - } catch (error) { - console.error("댓글 조회 실패:", error); - throw new Error("댓글 조회 중 오류가 발생했습니다."); - } -}; - -export default getComments; diff --git a/src/apis/question/getFaculties.ts b/src/apis/question/getFaculties.ts deleted file mode 100644 index f6000d3d..00000000 --- a/src/apis/question/getFaculties.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { apiClient } from "../appClient"; - -const getFaculties = async () => { - try { - const response = await apiClient.post( - "/api/sejong/faculty/get-all", - {}, - { - headers: { - "Content-Type": "multipart/form-data", - }, - }, - ); - - return response.data; - } catch (error) { - console.error("단과대 불러오는 중 오류 발생:", error); - throw new Error("단과대 불러오는 중 오류 발생했습니다."); - } -}; - -export default getFaculties; diff --git a/src/apis/question/getQuestionDetails.ts b/src/apis/question/getQuestionDetails.ts deleted file mode 100644 index 65a41853..00000000 --- a/src/apis/question/getQuestionDetails.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { QuestionDto } from "@/types/api/responses/questionDto"; -import { apiClient } from "../appClient"; - -// 특정 질문 글을 조회하는 함수 -export default async function getQuestionDetails(postId: string): Promise { - try { - // `FormData` 객체를 생성해 `postId` 추가 - const formData = new FormData(); - formData.append("postId", postId); - - // 특정 질문 글을 조회하기 위한 POST 요청을 보냄 (multipart/form-data 사용) - const response = await apiClient.post("/api/question/get", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - - console.log("Response Data:", response); // Add this line to inspect the API response - // 응답 데이터를 반환 - return response.data; - } catch (error) { - // 오류 발생 시 콘솔에 에러를 출력 - console.error("질문 조회 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/getUnansweredQNAs.ts b/src/apis/question/getUnansweredQNAs.ts deleted file mode 100644 index 98f8ec4d..00000000 --- a/src/apis/question/getUnansweredQNAs.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { apiClient } from "../appClient"; - -interface GetUnansweredQNAsProps { - faculty?: string; -} - -export default async function getUnansweredQNAs({ faculty }: GetUnansweredQNAsProps) { - const formData = new FormData(); - formData.append("pageNumber", "0"); // 기본값 0 - formData.append("pageSize", "30"); // 기본값 30 - formData.append("faculty", faculty || ""); // 기본값 "" - try { - const response = await apiClient.post("/api/question/unanswered", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - // return response.data.questionPostsPage.content; // API 호출 결과만 반환 - return response.data.questionPostsPage.content.map((post: any, index: number) => ({ - postId: post.questionPostId || index.toString(), - title: post.title, - subject: post.subject, - JiJeongTags: post.questionPresetTags || [], - rewardYeopjeon: post.rewardYeopjeon || 0, - likeCount: post.likeCount, - commentCount: post.commentCount, - })); - } catch (error) { - console.error("질문 목록을 가져오는 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/postAnswer.ts b/src/apis/question/postAnswer.ts deleted file mode 100644 index 5dea5459..00000000 --- a/src/apis/question/postAnswer.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { apiClient } from "../appClient"; - -interface PostAnswerFormData { - questionPostId: string; - content: string; - isPrivate?: boolean; - mediaFiles?: File[]; -} - -export default async function postAnswer(data: PostAnswerFormData) { - const formData = new FormData(); - - // 필수 항목 추가 - formData.append("questionPostId", data.questionPostId); - formData.append("content", data.content); - - // 선택 항목 추가 - if (data.isPrivate !== undefined) { - formData.append("isPrivate", data.isPrivate.toString()); - } - - // 첨부 파일 - if (data.mediaFiles && data.mediaFiles.length > 0) { - data.mediaFiles.forEach(file => { - formData.append("attachmentFiles", file); - }); - } - - try { - const response = await apiClient.post("/api/question/answer/post", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - return response.data; - } catch (error) { - console.error("답변 등록 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/postComment.ts b/src/apis/question/postComment.ts deleted file mode 100644 index 02bd1389..00000000 --- a/src/apis/question/postComment.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { ContentType } from "@/types/api/constants/contentType"; -import { apiClient } from "../appClient"; - -interface PostCommentParams { - content: string; - postId: string; - contentType: ContentType; - isPrivate?: boolean; -} - -const postComment = async ({ content, postId, contentType, isPrivate = false }: PostCommentParams) => { - try { - const formData = new FormData(); - formData.append("content", content); - formData.append("postId", postId); - formData.append("contentType", contentType); - formData.append("isPrivate", isPrivate.toString()); - - const response = await apiClient.post("/api/comment/post", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - - return response.data; - } catch (error) { - console.error("Failed to post comment:", error); - throw error; - } -}; - -export default postComment; diff --git a/src/apis/question/postLikeComment.ts b/src/apis/question/postLikeComment.ts deleted file mode 100644 index d258eacb..00000000 --- a/src/apis/question/postLikeComment.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { apiClient } from "../appClient"; - -interface CommentLikeResponse { - commentDto: Comment; -} - -// 특정 댓글에 좋아요를 누르는 함수 -export default async function postLikeComment(postId: string): Promise { - try { - // FormData 객체 생성 및 데이터 추가 - const formData = new FormData(); - formData.append("postId", postId); - - // 좋아요를 위한 POST 요청 - const response = await apiClient.post("/api/likes/comment", formData, { - headers: { - "Content-Type": "multipart/form-data", // Content-Type 설정 - }, - }); - - // 응답 데이터 반환 - return response.data; - } catch (error) { - // 오류 발생 시 처리 - console.error("댓글 좋아요 증가 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/postLikeQuestion.ts b/src/apis/question/postLikeQuestion.ts deleted file mode 100644 index 3eed6d6b..00000000 --- a/src/apis/question/postLikeQuestion.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { apiClient } from "../appClient"; - -interface LikeResponse { - questionPost: { - likeCount: number; - }; -} - -// 특정 질문 글 또는 답변에 좋아요를 누르는 함수 -export default async function postLikeQuestion(postId: string, contentType: string): Promise { - try { - // FormData 객체 생성 및 데이터 추가 - const formData = new FormData(); - formData.append("postId", postId); - formData.append("contentType", contentType); - - // 좋아요를 위한 POST 요청 - const response = await apiClient.post("/api/question/like", formData, { - headers: { - "Content-Type": "multipart/form-data", // Content-Type 설정 - }, - }); - - // 응답 데이터 반환 - return response.data; - } catch (error) { - // 오류 발생 시 에러 출력 - console.error("좋아요 증가 중 오류 발생:", error); - throw error; - } -} diff --git a/src/apis/question/refreshComments.ts b/src/apis/question/refreshComments.ts deleted file mode 100644 index 2c9d4b89..00000000 --- a/src/apis/question/refreshComments.ts +++ /dev/null @@ -1,34 +0,0 @@ -import getComments from "@/apis/question/getComments"; -import { Comment } from "@/types/api/entities/postgres/comment"; - -interface RefreshCommentsParams { - postId: string; - contentType: "QUESTION" | "ANSWER" | "DOCUMENT" | "DOCUMENT_REQUEST"; - setComments: React.Dispatch>; - setTotalComments?: React.Dispatch>; - pageNumber?: number; - pageSize?: number; -} - -export default async function refreshComments({ - postId, - contentType, - setComments, - setTotalComments, - pageNumber = 0, - pageSize = 30, -}: RefreshCommentsParams): Promise { - try { - // 댓글 API 호출 - const response = await getComments({ postId, contentType, pageNumber, pageSize }); - - // 상태 업데이트 - setComments(response.commentsPage.content); - - if (setTotalComments) { - setTotalComments(response.commentsPage.totalElements); - } - } catch (error) { - console.error("댓글 새로고침 중 오류 발생:", error); - } -} diff --git a/src/apis/search/getSearchResult.ts b/src/apis/search/getSearchResult.ts deleted file mode 100644 index a51170d5..00000000 --- a/src/apis/search/getSearchResult.ts +++ /dev/null @@ -1,22 +0,0 @@ -// import { apiClient } from "@/apis/appClient"; - -// export default async function getSearchResult({ params }: { params: { query: string; subject: string } }) { -// try { -// // FormData 객체 생성 -// const formData = new FormData(); -// formData.append("query", params.query); -// formData.append("subject", params.subject); - -// // POST 요청으로 회원 정보 조회 -// const response = await apiClient.post("/api/query", formData, { -// headers: { -// "Content-Type": "multipart/form-data", // Content-Type 설정 -// }, -// }); - -// return response.data; -// } catch (error) { -// console.error("회원 정보 가져오기 실패:", error); -// throw error; -// } -// } diff --git a/src/components/common/deprecated/AnswerInput.tsx b/src/components/common/deprecated/AnswerInput.tsx deleted file mode 100644 index d6234375..00000000 --- a/src/components/common/deprecated/AnswerInput.tsx +++ /dev/null @@ -1,29 +0,0 @@ -interface ContentTextareaProps { - value: string; - onChange: (e: React.ChangeEvent) => void; -} - -function AnswerInput({ value, onChange }: ContentTextareaProps) { - return ( -