261112_02_ENH: CTI 통화 이력 복구·재시도 로직 제거 및 시작·종료 저장 단일 요청으로 간소화

This commit is contained in:
2026-11-12 14:01:28 +09:00
parent 4daf2daf9c
commit 606b6e30d0
4 changed files with 41 additions and 275 deletions

View File

@@ -2,25 +2,7 @@ import {NextRequest, NextResponse} from "next/server";
import {RouteContext} from "@/types/common";
import {createContactApi} from "@/lib/http-server";
import {errorToResponse} from "@kri/common/http";
import type {ListCallHist, ListCallHistSession} from "@/types/list";
export const GET = async (_req: NextRequest, context: RouteContext) => {
try {
const { slug = [] } = await context.params;
const [action, agentSessionId] = slug;
if (action !== "session" || !agentSessionId) {
return NextResponse.json({ message: "Not found" }, { status: 404 });
}
const contactApi = await createContactApi();
const result = await contactApi.get<ListCallHistSession>(
`/list-call-hist/session/${encodeURIComponent(agentSessionId)}`,
);
return NextResponse.json(result, { status: 200 });
} catch (error: unknown) {
return errorToResponse(error);
}
};
import type {ListCallHist} from "@/types/list";
export const PUT = async (req: NextRequest, context: RouteContext) => {
try {
@@ -45,21 +27,3 @@ export const PUT = async (req: NextRequest, context: RouteContext) => {
return errorToResponse(error);
}
};
export const PATCH = async (_req: NextRequest, context: RouteContext) => {
try {
const { slug = [] } = await context.params;
const [action, agentSessionId] = slug;
if (action !== "hangup" || !agentSessionId) {
return NextResponse.json({ message: "Not found" }, { status: 404 });
}
const contactApi = await createContactApi();
const result = await contactApi.patch<boolean>(
`/list-call-hist/hangup/${encodeURIComponent(agentSessionId)}`,
);
return NextResponse.json(result, { status: 200 });
} catch (error: unknown) {
return errorToResponse(error);
}
};