260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋

This commit is contained in:
2026-07-16 09:12:57 +09:00
parent c710a60beb
commit 36c7b41191
29 changed files with 864 additions and 532 deletions

View File

@@ -1,53 +0,0 @@
import {NextRequest, NextResponse} from "next/server";
import {RouteContext} from "@/types/common";
import {createNotihubApi} from "@/lib/http-server";
import {errorToResponse} from "@kri/common/http";
import type {BulkSendCreateRequest, BulkSendResponse, SendRequestBulk} from "@kri/common/noti-hub";
type MessageSendChannel = "sms" | "email";
const isSendChannel = (value: string): value is MessageSendChannel => value === "sms" || value === "email";
export const PUT = async (req: NextRequest, context: RouteContext) => {
try {
const {slug = []} = await context.params;
const [action, channel] = slug;
const notihubApi = await createNotihubApi();
if (action === "create-bulk" && channel && isSendChannel(channel)) {
const body: BulkSendCreateRequest | null = await req.json().catch(() => null);
if (!body) {
return NextResponse.json({message: "요청 바디가 없습니다."}, {status: 400});
}
const result = await notihubApi.put<string>(`/send-${channel}/create/bulk`, body);
return NextResponse.json(result, {status: 200});
}
return NextResponse.json({message: "Not found"}, {status: 404});
} catch (error: unknown) {
return errorToResponse(error);
}
};
export const POST = async (req: NextRequest, context: RouteContext) => {
try {
const {slug = []} = await context.params;
const [action, channel] = slug;
const notihubApi = await createNotihubApi();
if (action === "bulk" && channel && isSendChannel(channel)) {
const body: SendRequestBulk | null = await req.json().catch(() => null);
if (!body) {
return NextResponse.json({message: "요청 바디가 없습니다."}, {status: 400});
}
const result = await notihubApi.post<BulkSendResponse>(`/send-${channel}/bulk`, body);
return NextResponse.json(result, {status: 200});
}
return NextResponse.json({message: "Not found"}, {status: 404});
} catch (error: unknown) {
return errorToResponse(error);
}
};