hofix-kkotamplate-alert #55

Merged
gitadmin merged 50 commits from hofix-kkotamplate-alert into develop 2026-10-20 08:36:27 +09:00
2 changed files with 19 additions and 19 deletions
Showing only changes of commit ad5aa5de73 - Show all commits

View File

@@ -15,17 +15,17 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
}
const { slug = [] } = await context.params;
const [action, prjctIdx, sid] = slug;
const [action, prjctCd, sid] = slug;
const contactApi = await createContactApiWithApiKey(apiKey);
if (action === "header" && prjctIdx) {
const result = await contactApi.get<string[]>(`/list-external/header/${prjctIdx}`);
if (action === "header" && prjctCd) {
const result = await contactApi.get<string[]>(`/list-external/header/${encodeURIComponent(prjctCd)}`);
return NextResponse.json(result, { status: 200 });
}
if (action === "search" && prjctIdx && sid) {
if (action === "search" && prjctCd && sid) {
const result = await contactApi.get<ListSearchExternal>(
`/list-external/search/${prjctIdx}/${encodeURIComponent(sid)}`,
`/list-external/search/${encodeURIComponent(prjctCd)}/${encodeURIComponent(sid)}`,
);
return NextResponse.json(result, { status: 200 });
}
@@ -45,13 +45,13 @@ export const PATCH = async (req: NextRequest, context: RouteContext) => {
}
const { slug = [] } = await context.params;
const [action, prjctIdx, sid] = slug;
const [action, prjctCd, sid] = slug;
if (action === "update" && prjctIdx && sid) {
if (action === "update" && prjctCd && sid) {
const body = await req.json().catch(() => null);
const contactApi = await createContactApiWithApiKey(apiKey);
const result = await contactApi.patch<number>(
`/list-external/update/${prjctIdx}/${encodeURIComponent(sid)}`,
`/list-external/update/${encodeURIComponent(prjctCd)}/${encodeURIComponent(sid)}`,
body,
);
return NextResponse.json(result, { status: 200 });
@@ -74,35 +74,35 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
const { slug = [] } = await context.params;
const [action] = slug;
const { searchParams } = req.nextUrl;
const prjctIdx = searchParams.get("prjctIdx");
const prjctCd = searchParams.get("prjctCd");
const sid = searchParams.get("sid");
const contactApi = await createContactApiWithApiKey(apiKey);
if (action === "header") {
if (!prjctIdx) {
return NextResponse.json({ message: "prjctIdx는 필수입니다." }, { status: 400 });
if (!prjctCd) {
return NextResponse.json({ message: "prjctCd는 필수입니다." }, { status: 400 });
}
const result = await contactApi.get<string[]>(`/list-external/header/${prjctIdx}`);
const result = await contactApi.get<string[]>(`/list-external/header/${encodeURIComponent(prjctCd)}`);
return NextResponse.json(result, { status: 200 });
}
if (action === "search") {
if (!prjctIdx || !sid) {
return NextResponse.json({ message: "prjctIdx, sid는 필수입니다." }, { status: 400 });
if (!prjctCd || !sid) {
return NextResponse.json({ message: "prjctCd, sid는 필수입니다." }, { status: 400 });
}
const result = await contactApi.get<ListSearchExternal>(
`/list-external/search/${prjctIdx}/${encodeURIComponent(sid)}`,
`/list-external/search/${encodeURIComponent(prjctCd)}/${encodeURIComponent(sid)}`,
);
return NextResponse.json(result, { status: 200 });
}
if (action === "update") {
if (!prjctIdx || !sid) {
return NextResponse.json({ message: "prjctIdx, sid는 필수입니다." }, { status: 400 });
if (!prjctCd || !sid) {
return NextResponse.json({ message: "prjctCd, sid는 필수입니다." }, { status: 400 });
}
const body = await req.json().catch(() => null);
const result = await contactApi.patch<number>(
`/list-external/update/${prjctIdx}/${encodeURIComponent(sid)}`,
`/list-external/update/${encodeURIComponent(prjctCd)}/${encodeURIComponent(sid)}`,
body,
);
return NextResponse.json(result, { status: 200 });

View File

@@ -369,7 +369,7 @@ export type ListSearchWithFullResult = ListSearchWithResult & {
};
export type ListSearchExternal = {
prjctIdx: number;
prjctCd: string;
sid: string;
itemList: Record<string, string>;
};