From f12c374a84586a478bac9f6397953686a73adeab Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 7 Oct 2026 11:24:24 +0900 Subject: [PATCH] =?UTF-8?q?261007=5F01=5FENH:=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20API=20contact-back=20=EA=B2=BD=EC=9C=A0=20=EC=A0=84?= =?UTF-8?q?=ED=99=98,=20=EB=B0=9C=EC=86=A1=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EB=B0=9C=EC=8B=A0=20=EC=9D=B4?= =?UTF-8?q?=EB=A9=94=EC=9D=BC=20=ED=98=95=EC=8B=9D=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 - .env.local | 2 -- .env.production | 1 - .../api/message-report/[[...slug]]/route.ts | 26 ++++++++--------- .../[[...slug]]/route.ts | 4 +-- .../api/message-template/[[...slug]]/route.ts | 28 +++++++++---------- .../message-template/MessageTemplate.tsx | 3 +- src/const/validationConst.ts | 3 ++ src/lib/env.server.ts | 2 -- src/lib/http-server.ts | 5 ---- src/query/message.ts | 20 ++++++------- 11 files changed, 44 insertions(+), 51 deletions(-) rename src/app/api/{message => message-send}/[[...slug]]/route.ts (92%) diff --git a/.env.development b/.env.development index b6892ea..747ab96 100644 --- a/.env.development +++ b/.env.development @@ -4,7 +4,6 @@ NEXT_PUBLIC_API_BASE=https://test-contact.kric.com/api ENV=dev CONTACT_SERVER=http://127.0.0.1:4001 API_CONTACT_SERVER=http://127.0.0.1:4001/api/v1 -API_NOTIHUB_SERVER=https://noti-hub.kric.com/api/v1 API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1 API_KART_SERVER=https://rapi.kric.com/api/v1 KART_API_KEY=4B726963-436F6E74616374-46726F6E74-402531213230 \ No newline at end of file diff --git a/.env.local b/.env.local index 2657ce9..9df2538 100644 --- a/.env.local +++ b/.env.local @@ -4,8 +4,6 @@ NEXT_PUBLIC_API_BASE=http://localhost:4000/api ENV=local CONTACT_SERVER=http://localhost:4001 API_CONTACT_SERVER=http://localhost:4001/api/v1 -API_NOTIHUB_SERVER=https://noti-hub.kric.com/api/v1 -#API_NOTIHUB_SERVER=http://localhost:4011/api/v1 API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1 API_KART_SERVER=https://rapi.kric.com/api/v1 KART_API_KEY=4B726963-436F6E74616374-46726F6E74-402531213230 \ No newline at end of file diff --git a/.env.production b/.env.production index 0b83de2..0159299 100644 --- a/.env.production +++ b/.env.production @@ -4,7 +4,6 @@ NEXT_PUBLIC_API_BASE=https://contact.kric.com/api ENV=prod CONTACT_SERVER=http://127.0.0.1:4001 API_CONTACT_SERVER=http://127.0.0.1:4001/api/v1 -API_NOTIHUB_SERVER=https://noti-hub.kric.com/api/v1 API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1 API_KART_SERVER=https://rapi.kric.com/api/v1 KART_API_KEY=4B726963-436F6E74616374-46726F6E74-402531213230 \ No newline at end of file diff --git a/src/app/api/message-report/[[...slug]]/route.ts b/src/app/api/message-report/[[...slug]]/route.ts index 15f2d80..b9bde87 100644 --- a/src/app/api/message-report/[[...slug]]/route.ts +++ b/src/app/api/message-report/[[...slug]]/route.ts @@ -1,6 +1,6 @@ import {NextRequest, NextResponse} from "next/server"; import {RouteContext} from "@/types/common"; -import {createNotihubApi} from "@/lib/http-server"; +import {createContactApi} from "@/lib/http-server"; import {errorToResponse} from "@kri/common/http"; import type {FileResponse, PageRequest, PageResponse} from "@kri/common"; import type {BulkSendInfo, SendResultSummaryRequest, SendResultSummaryResponse} from "@kri/common/noti-hub"; @@ -10,11 +10,11 @@ export const GET = async (req: NextRequest, context: RouteContext) => { try { const {slug = []} = await context.params; const [action, sendTy, reqstSvc, prjctCd] = slug; - const notihubApi = await createNotihubApi(); + const contactApi = await createContactApi(); if (action === "bulk-list" && sendTy && reqstSvc && prjctCd) { - const result = await notihubApi.get( - `/report/bulk-list/${sendTy}/${reqstSvc}/${prjctCd}`, + const result = await contactApi.get( + `/message-report/bulk-list/${sendTy}/${reqstSvc}/${prjctCd}`, ); return NextResponse.json(result, {status: 200}); } @@ -23,8 +23,8 @@ export const GET = async (req: NextRequest, context: RouteContext) => { const [, sid, prjctCdParam, reqstSvcParam] = slug; const channelTy = req.nextUrl.searchParams.get("channelTy"); const query = channelTy ? `?channelTy=${channelTy}` : ""; - const result = await notihubApi.get( - `/report/send-result/${encodeURIComponent(sid)}/${prjctCdParam}/${reqstSvcParam}${query}`, + const result = await contactApi.get( + `/message-report/send-result/${encodeURIComponent(sid)}/${prjctCdParam}/${reqstSvcParam}${query}`, ); return NextResponse.json(result, {status: 200}); } @@ -39,7 +39,7 @@ export const POST = async (req: NextRequest, context: RouteContext) => { try { const {slug = []} = await context.params; const [action, bulkSendKey] = slug; - const notihubApi = await createNotihubApi(); + const contactApi = await createContactApi(); if (action === "bulk-detail" && bulkSendKey) { const body: PageRequest | null = await req.json().catch(() => null); @@ -47,16 +47,16 @@ export const POST = async (req: NextRequest, context: RouteContext) => { return NextResponse.json({message: "요청 바디가 없습니다."}, {status: 400}); } - const result = await notihubApi.post>( - `/report/bulk-detail/${bulkSendKey}`, + const result = await contactApi.post>( + `/message-report/bulk-detail/${bulkSendKey}`, body, ); return NextResponse.json(result, {status: 200}); } if (action === "bulk-detail-excel" && bulkSendKey) { - const result = await notihubApi.post( - `/report/bulk-detail/excel/${bulkSendKey}`, + const result = await contactApi.post( + `/message-report/bulk-detail-excel/${bulkSendKey}`, undefined, ); return NextResponse.json(result, {status: 200}); @@ -68,8 +68,8 @@ export const POST = async (req: NextRequest, context: RouteContext) => { return NextResponse.json({message: "요청 바디가 없습니다."}, {status: 400}); } - const result = await notihubApi.post( - `/report/send-result-summary`, + const result = await contactApi.post( + `/message-report/send-result-summary`, body, ); return NextResponse.json(result, {status: 200}); diff --git a/src/app/api/message/[[...slug]]/route.ts b/src/app/api/message-send/[[...slug]]/route.ts similarity index 92% rename from src/app/api/message/[[...slug]]/route.ts rename to src/app/api/message-send/[[...slug]]/route.ts index d24ac93..23501c3 100644 --- a/src/app/api/message/[[...slug]]/route.ts +++ b/src/app/api/message-send/[[...slug]]/route.ts @@ -22,12 +22,12 @@ export const POST = async (req: NextRequest, context: RouteContext) => { } if (action === "single") { - const result = await contactApi.post(`/message/${channel}/single/${prjctIdx}`, body); + const result = await contactApi.post(`/message-send/${channel}/single/${prjctIdx}`, body); return NextResponse.json(result, {status: 200}); } if (action === "bulk") { - const result = await contactApi.post(`/message/${channel}/bulk/${prjctIdx}`, body); + const result = await contactApi.post(`/message-send/${channel}/bulk/${prjctIdx}`, body); return NextResponse.json(result, {status: 200}); } diff --git a/src/app/api/message-template/[[...slug]]/route.ts b/src/app/api/message-template/[[...slug]]/route.ts index bd542d0..2fa1680 100644 --- a/src/app/api/message-template/[[...slug]]/route.ts +++ b/src/app/api/message-template/[[...slug]]/route.ts @@ -1,6 +1,6 @@ import {NextRequest, NextResponse} from "next/server"; import {RouteContext} from "@/types/common"; -import {createNotihubApi} from "@/lib/http-server"; +import {createContactApi} from "@/lib/http-server"; import {errorToResponse} from "@kri/common/http"; import type { Template, TemplateSummary } from "@kri/common/noti-hub"; @@ -9,7 +9,7 @@ export const GET = async (req: NextRequest, context: RouteContext) => { const { searchParams } = new URL(req.url); const {slug = []} = await context.params; const [action] = slug; - const notihubApi = await createNotihubApi(); + const contactApi = await createContactApi(); if(slug.length === 2 && slug[1] === "attachment"){ const fileName = searchParams.get("fileName"); @@ -17,23 +17,23 @@ export const GET = async (req: NextRequest, context: RouteContext) => { return NextResponse.json({ message: "fileName은 필수입니다." }, { status: 400 }); } - const result = await notihubApi.get( - `/template/${slug[0]}/attachment?fileName=${encodeURIComponent(fileName)}`, + const result = await contactApi.get( + `/message-template/${slug[0]}/attachment?fileName=${encodeURIComponent(fileName)}`, { expectBinary: true }, ); return new NextResponse(result, { status: 200, headers: { "Content-Type": "application/octet-stream" } }); } if(slug.length === 1){ - const result = await notihubApi.get