261008_01_ENH: 알림톡 템플릿 관련내용 구현 및 발송 구현

This commit is contained in:
2026-10-08 11:20:42 +09:00
parent f12c374a84
commit 264707ac56
33 changed files with 803 additions and 143 deletions

View File

@@ -2,7 +2,31 @@
import {RouteContext} from "@/types/common";
import {createContactApi} from "@/lib/http-server";
import {errorToResponse} from "@kri/common/http";
import type { Template, TemplateSummary } from "@kri/common/noti-hub";
import type { KkoTemplateDetail, KkoTemplateListResponse, Template, TemplateSummary } from "@kri/common/noti-hub";
// 외부 알림톡 템플릿 목록·상세 조회. JSON 본문을 contact-back에 그대로 전달한다.
export const POST = async (req: NextRequest, context: RouteContext) => {
try{
const {slug = []} = await context.params;
const [channel, action] = slug;
if (channel !== "kko" || slug.length !== 2 || (action !== "list" && action !== "detail")) {
return NextResponse.json({ message: "Not found" }, { status: 404 });
}
const body = await req.json().catch(() => null);
if (!body || typeof body !== "object") {
return NextResponse.json({ message: "요청 바디가 없습니다." }, { status: 400 });
}
const contactApi = await createContactApi();
const result = action === "list"
? await contactApi.post<KkoTemplateListResponse>(`/message-template/kko/list`, body)
: await contactApi.post<KkoTemplateDetail>(`/message-template/kko/detail`, body);
return NextResponse.json(result, { status: 200 });
} catch (error: unknown) {
return errorToResponse(error);
}
}
export const GET = async (req: NextRequest, context: RouteContext) => {
try{