261029_01_ENH: 이메일·문자·알림톡 템플릿 삭제 기능 추가 및 삭제

This commit is contained in:
2026-10-29 09:04:06 +09:00
parent 55c988ce20
commit e67d57c51a
4 changed files with 110 additions and 0 deletions

View File

@@ -138,3 +138,20 @@ export const PATCH = async (req: NextRequest, context: RouteContext) => {
return errorToResponse(error);
}
}
// 템플릿 삭제. 성공 응답은 빈 body이므로 JSON으로 파싱하지 않는다.
export const DELETE = async (req: NextRequest, context: RouteContext) => {
try{
const {slug = []} = await context.params;
const [tmplatIdx] = slug;
if (slug.length !== 1 || !/^[1-9]\d*$/.test(tmplatIdx)) {
return NextResponse.json({ message: "Not found" }, { status: 404 });
}
const contactApi = await createContactApi();
await contactApi.del(`/message-template/${tmplatIdx}`, { expectText: true });
return new NextResponse(null, { status: 204 });
} catch (error: unknown) {
return errorToResponse(error);
}
}