diff --git a/apps/cs/docs/spec/ntftalk/temp/SPEC.md b/apps/cs/docs/spec/ntftalk/temp/SPEC.md index 0b84ace4a..81f361925 100644 --- a/apps/cs/docs/spec/ntftalk/temp/SPEC.md +++ b/apps/cs/docs/spec/ntftalk/temp/SPEC.md @@ -260,3 +260,79 @@ BEGIN END ``` + +--- + +## 9. 템플릿 등록 다이얼로그 + +대상 UI: `NtftalkTempRegistDialog` (`apps/cs/src/pages/ntftalk-temp/ui/ntftalk-temp-regist-dialog.tsx`) + +### 9-1. 목적/오픈 조건 + +- 목적: 신규 알림톡 템플릿 1건을 등록한다. +- 오픈 조건: 영역 B 툴바의 `템플릿등록` 클릭 시 모달 오픈. +- 저장 성공 시: 목록 캐시 무효화 후 영역 B 재조회 상태로 복귀(모달 닫힘). + +### 9-2. 다이얼로그 레이아웃 + +``` +┌──────────────────────────────────────────────────────────────────────┐ +│ 알림 템플릿 등록 │ +├──────────────────────────────────────────────────────────────────────┤ +│ 메시지 유형 [기본형(고정)] │ +│ 채널 [Select(senderKey)] │ +│ 템플릿코드 [Input] │ +│ 템플릿명 [Input] │ +│ 보안템플릿여부 ( )설정 ( )미설정 │ +│ 템플릿내용 [+ 변수추가] │ +│ [Textarea] │ +│ 버튼 Table(버튼타입|버튼명|버튼링크) │ +│ [CodeSelect(upCd: NTFBUTTONTYPE) | Input | Input] │ +│ 바로연결 Table(바로연결타입|바로연결명|바로연결링크) │ +│ [CodeSelect(upCd: NTFQRTYPE) | Input | Input] │ +├──────────────────────────────────────────────────────────────────────┤ +│ [저장] [취소] │ +└──────────────────────────────────────────────────────────────────────┘ +``` + +### 9-3. 필드 상세 + +| 표시명 | Form Key | 입력 유형 | 필수 | 기본값 | 검증/제약 | 저장 Payload 매핑 | +| -------------- | ----------------------- | ----------- | ---- | ------------------------------------- | -------------------- | --------------------- | +| 메시지 유형 | `templateMessageType` | 고정 텍스트 | Y | `BA` | UI에서 `기본형` 고정 | `templateMessageType` | +| 채널 | `senderKey` | Select | Y | `senderQuery.data.senderKey` 자동세팅 | 미선택 불가 | `senderKey` | +| 발신키 유형 | `senderKeyType` | hidden 상수 | Y | `S` | submit 시 강제 `S` | `senderKeyType` | +| 템플릿코드 | `templateCode` | Input | Y | `""` | 1자 이상 | `templateCode` | +| 템플릿명 | `templateName` | Input | Y | `""` | 1자 이상 | `templateName` | +| 보안템플릿여부 | `templateEmphasizeType` | Radio | N | `false` | `true` / `false` | `pcflag` | +| 템플릿내용 | `templateContent` | Textarea | Y | `""` | 1자 이상 | `templateContent` | +| 버튼 | `buttons` | Table | N | `[]` | 빈 배열 | `buttons` | +| 바로연결 | `quickReplies` | Table | N | `[]` | 빈 배열 | `quickReplies` | + +### 9-4. 버튼/이벤트 상세 + +| 트리거 | 처리 로직 | 비고 | +| ---------------- | ----------------------------------------------- | ------------------------------------ | +| 템플릿등록(외부) | 다이얼로그 open = true, form reset | 진입 시 초기화 | +| 저장 | zod 검증 통과 후 `saveNtftalkTemp` 호출 | 성공 시 `등록되었습니다.` 알림 | +| 저장 성공 | `invalidateQueries([NTFTALK_TEMP])` → 모달 닫기 | 목록 최신화 | +| 저장 실패 | 공통 mutation error 처리 | 에러 메시지 표시 정책 공통 모듈 따름 | +| + 변수추가 | 변수 선택 팝업 open | 9-5 참조 | + +### 9-5. 변수추가 팝업 상세 + +| 항목 | 내용 | +| ----------- | -------------------------------------------------------------------- | +| 팝업명 | 변수 목록 | +| 데이터 소스 | `NtftalkVarApi.getNtftalkVarPage` | +| 조회 조건 | `sort=regDt,desc`, 페이지네이션(`pageIndex/pageSize`) | +| 선택 방식 | 다중 선택 (`RowSelectionState`) | +| [추가] 동작 | 선택된 `varCd`를 줄바꿈(`\n`)으로 `templateContent` 하단에 append | +| 유효성 체크 | 선택 0건: "추가할 변수를 선택해 주세요." / `varCd` 공백 포함 시 에러 | +| [취소] 동작 | 팝업 닫기(선택값 유지 안 함) | + +### 9-6. API 명세 + +| 기능 | Method | URL | Request DTO | Response DTO | 클라이언트 API | +| ----------- | ------ | --------------- | ------------------------ | ------------- | -------------------------------- | +| 템플릿 등록 | POST | `/ntftalk-temp` | `NtftalkTempSavePayload` | `NtftalkTemp` | `NtftalkTempApi.saveNtftalkTemp` | diff --git a/apps/cs/src/entities/ntftalk/model/ntftalk-temp-interface.ts b/apps/cs/src/entities/ntftalk/model/ntftalk-temp-interface.ts index 34ed20803..5149ad230 100644 --- a/apps/cs/src/entities/ntftalk/model/ntftalk-temp-interface.ts +++ b/apps/cs/src/entities/ntftalk/model/ntftalk-temp-interface.ts @@ -46,6 +46,7 @@ export interface NtftalkTemp { templateImageUrl: string; inspectionStatus: string; inspectionStatusNm: string; + pcflag: string; status: string; statusNm: string; createdAt: string; @@ -85,6 +86,7 @@ export interface NtftalkTempSavePayload { templateEmphasizeType: string; templateImageUrl?: string; inspectionStatus?: string; + pcflag?: string; buttons?: NtftalkBtnTempSavePayload[]; quickReplies?: NtftalkQuickTempSavePayload[]; } @@ -94,6 +96,7 @@ export interface NtftalkTempUpdatePayload { templateContent: string; inspectionStatus?: string; status?: string; + pcflag?: string; buttons?: NtftalkBtnTempSavePayload[]; quickReplies?: NtftalkQuickTempSavePayload[]; }