261008_01_ENH: 알림톡 템플릿 관련내용 구현 및 발송 구현

This commit is contained in:
2026-10-08 11:20:42 +09:00
parent f12c374a84
commit 264707ac56
33 changed files with 803 additions and 143 deletions

View File

@@ -1,35 +1,21 @@
import type { Template, TemplateEmail, TemplateSms, TemplateSummary } from '@kri/common/noti-hub';
import type { MessageType, Template, TemplatePurpose, TemplateSummary } from '@kri/common/noti-hub';
import type { ListFilter } from './list';
export type TemplatePurpose = 0 | 1;
// 서버 조회 응답은 모든 채널의 템플릿에 tmplatPurpose를 내려준다. 화면 상태에서는 필수로 다룬다.
export type TemplateWithPurpose = Template & {
tmplatPurpose: TemplatePurpose;
};
export type TemplateSummaryWithPurpose = TemplateSummary & {
tmplatPurpose: TemplatePurpose;
};
/** 이메일·문자 템플릿 관리 화면(MessageTemplate) 상태. 알림톡은 별도 화면에서 다룬다. */
export type SmsEmailTemplateWithPurpose = Exclude<TemplateWithPurpose, { tmplatTy: MessageType.KKO }>;
export type MessageSendChannel = 'sms' | 'email';
export type TemplateSummaryWithPurpose = TemplateSummary & Required<Pick<TemplateSummary, 'tmplatPurpose'>>;
/**
* @kri/common의 TemplateEmail에는 atchFl(첨부파일 필드)이 아직 없어 로컬에서 확장한다.
* 조회 응답 전용 필드로, 파이프(|)로 구분된 첨부파일명 목록이 내려온다. 요청 시엔 사용하지 않는다.
*/
export type TemplateEmailWithAttachments = TemplateEmail & {
tmplatPurpose: TemplatePurpose;
atchFl?: string;
};
export type MessageSendChannel = 'sms' | 'email' | 'kko';
/**
* 문자 템플릿 JPG 첨부파일명 목록 (TemplateEmailWithAttachments와 동일하게 조회 응답 전용).
* 첨부가 하나라도 있으면 서버가 LMS_MMS로 저장한다.
*/
export type TemplateSmsWithAttachments = TemplateSms & {
tmplatPurpose: TemplatePurpose;
atchFl?: string;
};
/** 조회 응답의 첨부파일명 목록(atchFl, 파이프 구분). 알림톡 템플릿에는 첨부가 없다. */
export const getTemplateAttachmentNames = (template: Template): string[] =>
'atchFl' in template && template.atchFl ? template.atchFl.split('|').filter(Boolean) : [];
/** 문자 미리보기에 표시할 첨부 이미지 (src는 data URL 또는 Object URL) */
export type TemplateAttachmentImage = {
@@ -64,43 +50,3 @@ export type MessageSendBulkRequest = {
destHeaderIds: number[];
destNameHeaderId?: number;
};
export type MessageFailedChunk = {
sidList?: string[];
reason?: string;
};
export type MessageBulkSendResponse = {
bulkSendKey?: string;
targetCount: number;
requestCount: number;
acceptCount: number;
failCount: number;
failedChunks?: MessageFailedChunk[];
};
export type SendResultInfo = {
cmid: string;
bulkSendKey?: string;
sendTy: number;
itrntPrjctCd: string;
reqstSvc: string;
prjctCd: string;
sid: string;
resve: boolean;
resultCode: number;
resultLabel?: string;
resultViewLabel?: string;
tmplatIdx?: number;
kkoTmplatCd?: string;
sendEml?: string;
sendTel?: string;
sendNm?: string;
sendDt: string;
destEml?: string;
destNm?: string;
destTel?: string;
regCmpn: string;
regUser: string;
regDt: string;
};