261008_01_ENH: 알림톡 템플릿 관련내용 구현 및 발송 구현
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { MessageType, type TemplateEmail } from "@kri/common/noti-hub";
|
||||
import { MessageType, TemplatePurpose, type TemplateEmail } from "@kri/common/noti-hub";
|
||||
import MessageTemplate from "@/components/message-template/MessageTemplate";
|
||||
import type { TemplateWithPurpose } from "@/types/message";
|
||||
|
||||
@@ -8,7 +8,7 @@ const EmailTemplatePage = () => {
|
||||
tmplatIdx: undefined,
|
||||
itrntPrjctCd: '',
|
||||
tmplatTy: MessageType.EMAIL,
|
||||
tmplatPurpose: 0,
|
||||
tmplatPurpose: TemplatePurpose.NORMAL,
|
||||
tmplatNm: '',
|
||||
tmplatTitle: '',
|
||||
tmplatBody: '',
|
||||
|
||||
13
src/app/(pages)/(main)/message/template/kko/page.tsx
Normal file
13
src/app/(pages)/(main)/message/template/kko/page.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import KkoMessageTemplate from "@/components/message-template/KkoMessageTemplate";
|
||||
|
||||
const KkoTemplatePage = () => {
|
||||
return (
|
||||
<div className="space-y-6 text-sm">
|
||||
<KkoMessageTemplate />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default KkoTemplatePage;
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { MessageType, type TemplateSms } from "@kri/common/noti-hub";
|
||||
import { MessageType, TemplatePurpose, type TemplateSms } from "@kri/common/noti-hub";
|
||||
import MessageTemplate from "@/components/message-template/MessageTemplate";
|
||||
import type { TemplateWithPurpose } from "@/types/message";
|
||||
|
||||
@@ -10,7 +10,7 @@ const SmsTemplatePage = () => {
|
||||
tmplatIdx: undefined,
|
||||
itrntPrjctCd: '',
|
||||
tmplatTy: MessageType.SMS,
|
||||
tmplatPurpose: 0,
|
||||
tmplatPurpose: TemplatePurpose.NORMAL,
|
||||
tmplatNm: '',
|
||||
tmplatTitle: undefined,
|
||||
tmplatBody: '',
|
||||
|
||||
@@ -23,6 +23,7 @@ import { useMounted } from "@kri/common/hooks";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
import {useItrntUserList} from "@/hooks/useItrntUserList";
|
||||
import {useRouter} from "next/navigation";
|
||||
import type {Route} from "next";
|
||||
import {useCreateProjectMutation, useProjectListQuery, useProjectOwnerListQuery} from "@/query/project";
|
||||
import {useGroupCodeListQuery} from "@/query/intranet";
|
||||
import {PROJECT_STATUS_LABEL} from "@/const/projectConst";
|
||||
@@ -123,7 +124,7 @@ const MainPage = () => {
|
||||
showDialog('projectCreateDialog');
|
||||
}
|
||||
|
||||
const navigateWithProject = (projectInfo: ProjectInfo, path: string) => {
|
||||
const navigateWithProject = (projectInfo: ProjectInfo, path: Route) => {
|
||||
setSelectedProject({
|
||||
prjctIdx: projectInfo.prjctIdx,
|
||||
prjctCd: projectInfo.prjctCd,
|
||||
|
||||
@@ -11,12 +11,13 @@ import { clientEnv } from "@/lib/env.client";
|
||||
import { MessageType } from "@kri/common/noti-hub";
|
||||
import type { SendResultSummaryResponse } from "@kri/common/noti-hub";
|
||||
|
||||
const SEND_TYPE_ORDER = [MessageType.SMS, MessageType.LMS_MMS, MessageType.EMAIL] as const;
|
||||
const SEND_TYPE_ORDER = [MessageType.SMS, MessageType.LMS_MMS, MessageType.EMAIL, MessageType.KKO] as const;
|
||||
|
||||
const SEND_TYPE_LABEL: Record<number, string> = {
|
||||
[MessageType.SMS]: "단문",
|
||||
[MessageType.LMS_MMS]: "장문",
|
||||
[MessageType.EMAIL]: "메일",
|
||||
[MessageType.KKO]: "알림톡",
|
||||
};
|
||||
|
||||
type SummaryRow = {
|
||||
|
||||
@@ -3,8 +3,7 @@ import {RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import type {FileResponse, PageRequest, PageResponse} from "@kri/common";
|
||||
import type {BulkSendInfo, SendResultSummaryRequest, SendResultSummaryResponse} from "@kri/common/noti-hub";
|
||||
import type {SendResultInfo} from "@/types/message";
|
||||
import type {BulkSendInfo, SendResultInfo, SendResultSummaryRequest, SendResultSummaryResponse} from "@kri/common/noti-hub";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
|
||||
@@ -2,9 +2,11 @@ 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 {MessageBulkSendResponse, SendSingleResponse} from "@/types/message";
|
||||
import type {BulkSendResult} from "@kri/common/noti-hub";
|
||||
import type {MessageSendChannel, SendSingleResponse} from "@/types/message";
|
||||
|
||||
const isChannel = (value: string): value is "sms" | "email" => value === "sms" || value === "email";
|
||||
const isChannel = (value: string): value is MessageSendChannel =>
|
||||
value === "sms" || value === "email" || value === "kko";
|
||||
|
||||
export const POST = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
@@ -27,7 +29,7 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
|
||||
}
|
||||
|
||||
if (action === "bulk") {
|
||||
const result = await contactApi.post<MessageBulkSendResponse>(`/message-send/${channel}/bulk/${prjctIdx}`, body);
|
||||
const result = await contactApi.post<BulkSendResult>(`/message-send/${channel}/bulk/${prjctIdx}`, body);
|
||||
return NextResponse.json(result, {status: 200});
|
||||
}
|
||||
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user