import { BOARD_PATHS } from '@/lib/domain/board-post-query'; /** * 관리자 알림 한 건. 백엔드 `CmmNtcnVo`(`TB_COM_NTCN`). * * 이름을 `Notification`으로 두지 않는다 — 브라우저 전역 타입과 겹쳐 클라이언트 코드에서 * 어느 쪽인지 흐려진다. */ export type AdminNotification = { /** 백엔드 `ntcnSn` — 일련번호이자 키. */ id: string; /** 백엔드 `ntcnSj` — 제목. */ title: string; /** 백엔드 `ntcnCn` — 내용. */ content: string; /** 백엔드 `readYn`. 값이 없으면 안 읽은 것으로 본다. */ isRead: boolean; }; export function countUnread( notifications: readonly AdminNotification[] ): number { return notifications.filter((item) => !item.isRead).length; } /** * 이슈: `TB_COM_NTCN`에 대상(게시판·게시글) 컬럼이 없어 제목으로 가른다. 지금 적재되는 알림은 * 학습자 1:1문의 등록(`CmmBbsServiceImpl.insert`, 제목 "학습자 1:1 문의 등록") 하나다. * 모르는 알림은 null — 누를 곳이 없다. */ export function resolveNotificationHref( notification: AdminNotification ): string | null { return notification.title.includes('1:1 문의') ? BOARD_PATHS.inquiry : null; }