diff --git a/src/app/api/qna/detail/route.ts b/src/app/api/qna/detail/route.ts index 1ac937c..276c939 100644 --- a/src/app/api/qna/detail/route.ts +++ b/src/app/api/qna/detail/route.ts @@ -3,6 +3,59 @@ import axios from 'axios' import { NextResponse } from 'next/server' import { loggerWrapper } from '@/libs/api-wrapper' +/** + * @api {GET} /api/qna/detail 문의 상세 조회 API + * @apiName GET /api/qna/detail + * @apiGroup Qna + * @apiDescription 문의 상세 조회 API + * + * @apiParam {String} compCd 회사 코드 + * @apiParam {String} qnaNo 문의 번호 + * @apiParam {String} langCd 언어 코드 + * @apiParam {String} loginId 로그인 ID + * + * @apiExample {curl} Example usage: + * curl -X GET http://localhost:3000/api/qna/detail + * + * @apiSuccessExample {json} Success-Response: + * { + * "data": { + "compCd": "5200", + "qnaNo": 51, + "qstTitle": "Q.CAST TEST", + "qstContents": "Q.CAST TEST CONTENTS", + "regDt": "2025.04.29 16:16:51", + "regId": "X112", + "regNm": "株式会社アイ工務店", + "regEmail": "x112@interplug.co.kr", + "answerYn": "N", + "ansContents": null, + "ansRegDt": null, + "ansRegNm": null, + "ansListFile": null, + "storeId": "X112", + "storeNm": "株式会社アイ工務店", + "regUserNm": "TEST", + "regUserTelNo": "010-1111-1111", + "qnaClsLrgCd": "A01", + "qnaClsMidCd": "B02", + "qnaClsSmlCd": "C05", + "listFile": [ + { + "fileNo": 853 + "encodeFileNo": 853, + "srcFileNm": "Quotation_4500380_20240808145129.pdf", + "fileCours": "/temp/20250428/" + "fileSize":160982, + "regDt":"2024.08.13" + } + ... + ], + ... + }, + * @apiError {Number} 401 세션 정보 없음 (로그인 필요) + * @apiError {Number} 500 서버 오류 + */ async function getQnaDetail(request: Request): Promise { const { searchParams } = new URL(request.url) const params = { diff --git a/src/app/api/qna/list/route.ts b/src/app/api/qna/list/route.ts index 12cf96e..7accef4 100644 --- a/src/app/api/qna/list/route.ts +++ b/src/app/api/qna/list/route.ts @@ -7,6 +7,51 @@ import { loggerWrapper } from '@/libs/api-wrapper' import { sessionOptions } from '@/libs/session' import { SessionData } from '@/types/Auth' +/** + * @api {GET} /api/qna/list 문의 목록 조회 API + * @apiName GET /api/qna/list + * @apiGroup Qna + * @apiDescription 문의 목록 조회 API + * + * @apiParam {String} compCd 회사 코드 + * @apiParam {String} langCd 언어 코드 + * @apiParam {String} storeId 판매점 ID + * @apiParam {String} siteTpCd 사이트 유형 코드 + * @apiParam {String} schTitle 검색 제목 + * @apiParam {String} schRegId 검색 등록자 ID + * @apiParam {String} schFromDt 검색 시작 일자 + * @apiParam {String} schToDt 검색 종료 일자 + * @apiParam {String} schAnswerYn 검색 답변 여부 + * @apiParam {String} loginId 로그인 ID + * + * @apiExample {curl} Example usage: + * curl -X GET http://localhost:3000/api/qna/list + * + * @apiSuccessExample {json} Success-Response: + * { + * "data": [ + { + "totCnt": 1, + "rowNumber": 1, + "compCd": "5200", + "qnaNo": 51, + "qstTitle": "Q.CAST TEST22", + "regDt": "2025.05.12", + "regId": "X112", + "regNm": "株式会社アイ工務店", + "answerYn": "N", + "attachYn": null, + "qnaClsLrgCd": "見積関連", + "qnaClsMidCd": "構造設置可否", + "qnaClsSmlCd": "C05 未定2", + "regUserNm": "Test" + }, + ... + ], +} + * @apiError {Number} 500 서버 오류 + * @apiError {Number} 401 세션 정보 없음 (로그인 필요) + */ async function getQnaList(request: Request): Promise { const cookieStore = await cookies() const session = await getIronSession(cookieStore, sessionOptions) diff --git a/src/app/api/qna/route.ts b/src/app/api/qna/route.ts index 2773761..b9c0d64 100644 --- a/src/app/api/qna/route.ts +++ b/src/app/api/qna/route.ts @@ -3,6 +3,34 @@ import axios from 'axios' import { CommonCode } from '@/types/Inquiry' import { loggerWrapper } from '@/libs/api-wrapper' +/** + * @api {GET} /api/qna 문의 유형 목록 조회 API + * @apiName GET /api/qna + * @apiGroup Qna + * @apiDescription 문의 유형 목록 조회 API + * + * @apiSuccess {Object} data 문의 유형 목록 + * @apiSuccess {String} data.headCd 문의 유형 헤드 코드 + * @apiSuccess {String} data.code 문의 유형 코드 + * @apiSuccess {String} data.codeJp 문의 유형 이름 - 일본어 + * @apiSuccess {String} data.refChr1 문의 유형 참조 - 유형 상위 구분 + * + * @apiExample {curl} Example usage: + * curl -X GET http://localhost:3000/api/qna + * + * @apiSuccessExample {json} Success-Response: + * { + * "data": [ + * { + * "headCd": "204200", + * "code": "1", + * "codeJp": "1", + * "refChr1": "1" + * } + * ], + * ... + * } + */ async function getCommonCodeListData(request: Request): Promise { const response = await axios.get(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/system/commonCodeListData`) const codeList: CommonCode[] = [] diff --git a/src/app/api/qna/save/route.ts b/src/app/api/qna/save/route.ts index 8cd1ad5..eb1fd6d 100644 --- a/src/app/api/qna/save/route.ts +++ b/src/app/api/qna/save/route.ts @@ -2,6 +2,27 @@ import axios from 'axios' import { NextResponse } from 'next/server' import { loggerWrapper } from '@/libs/api-wrapper' +/** + * @api {POST} /api/qna/save 문의 저장 API + * @apiName POST /api/qna/save + * @apiGroup Qna + * @apiDescription 문의 저장 API + * + * @apiBody {InquiryRequest} inquiryRequest 문의 저장 요청 파라미터 + * + * @apiExample {curl} Example usage: + * curl -X POST http://localhost:3000/api/qna/save + * + * @apiSuccessExample {json} Success-Response: + * { + * "data" : { + * "cnt": 1, + * "qnoNo": 1, + * "mailYn": "Y" + * }, + * }, + * @apiError {Number} 500 서버 오류 + */ async function setQna(request: Request): Promise { const formData = await request.formData() console.log(formData)