- UsersPanel: 테이블+페이징+등록모달+상세모달(비밀번호초기화/잠금해제) - PermissionsPanel: 사용자별 역할 할당 탭 추가 - BoardMgmtPanel: 공지사항/게시판/QNA 관리자 일괄 삭제 - VesselSignalPanel: VTS/VTS-AIS/V-PASS/E-NAVI/S&P AIS 타임라인 모니터링 - AdminSidebar/AdminPlaceholder/adminMenuConfig 신규 - 권한 미들웨어 부모 리소스 fallback 로직 추가 - 조직 목록 API, 관리자 삭제 API 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
142 lines
3.5 KiB
TypeScript
142 lines
3.5 KiB
TypeScript
import { api } from '@common/services/api';
|
|
|
|
// ============================================================
|
|
// 인터페이스
|
|
// ============================================================
|
|
|
|
export interface BoardPostItem {
|
|
sn: number;
|
|
categoryCd: string;
|
|
title: string;
|
|
authorId: string;
|
|
authorName: string;
|
|
viewCnt: number;
|
|
pinnedYn: string;
|
|
regDtm: string;
|
|
}
|
|
|
|
export interface BoardPostDetail extends BoardPostItem {
|
|
content: string | null;
|
|
mdfcnDtm: string | null;
|
|
}
|
|
|
|
export interface BoardListResponse {
|
|
items: BoardPostItem[];
|
|
totalCount: number;
|
|
page: number;
|
|
size: number;
|
|
}
|
|
|
|
export interface BoardListParams {
|
|
categoryCd?: string;
|
|
search?: string;
|
|
page?: number;
|
|
size?: number;
|
|
}
|
|
|
|
export interface CreateBoardPostInput {
|
|
categoryCd: string;
|
|
title: string;
|
|
content?: string;
|
|
pinnedYn?: string;
|
|
}
|
|
|
|
export interface UpdateBoardPostInput {
|
|
title?: string;
|
|
content?: string;
|
|
pinnedYn?: string;
|
|
}
|
|
|
|
// ============================================================
|
|
// API 함수
|
|
// ============================================================
|
|
|
|
export async function fetchBoardPosts(params?: BoardListParams): Promise<BoardListResponse> {
|
|
const response = await api.get<BoardListResponse>('/board', { params });
|
|
return response.data;
|
|
}
|
|
|
|
export async function fetchBoardPost(sn: number): Promise<BoardPostDetail> {
|
|
const response = await api.get<BoardPostDetail>(`/board/${sn}`);
|
|
return response.data;
|
|
}
|
|
|
|
export async function createBoardPost(input: CreateBoardPostInput): Promise<{ sn: number }> {
|
|
const response = await api.post<{ sn: number }>('/board', input);
|
|
return response.data;
|
|
}
|
|
|
|
export async function updateBoardPost(sn: number, input: UpdateBoardPostInput): Promise<void> {
|
|
await api.put(`/board/${sn}`, input);
|
|
}
|
|
|
|
export async function deleteBoardPost(sn: number): Promise<void> {
|
|
await api.delete(`/board/${sn}`);
|
|
}
|
|
|
|
/** 관리자 전용 삭제 — 소유자 검증 없음 */
|
|
export async function adminDeleteBoardPost(sn: number): Promise<void> {
|
|
await api.post('/board/admin-delete', { sn });
|
|
}
|
|
|
|
// ============================================================
|
|
// 매뉴얼 API
|
|
// ============================================================
|
|
|
|
export interface ManualItem {
|
|
manualSn: number;
|
|
catgNm: string;
|
|
title: string;
|
|
version: string | null;
|
|
fileTp: string | null;
|
|
fileSz: string | null;
|
|
filePath: string | null;
|
|
authorNm: string | null;
|
|
dwnldCnt: number;
|
|
regDtm: string;
|
|
}
|
|
|
|
export interface CreateManualInput {
|
|
catgNm: string;
|
|
title: string;
|
|
version?: string;
|
|
fileTp?: string;
|
|
fileSz?: string;
|
|
filePath?: string;
|
|
authorNm?: string;
|
|
}
|
|
|
|
export interface UpdateManualInput {
|
|
catgNm?: string;
|
|
title?: string;
|
|
version?: string;
|
|
fileTp?: string;
|
|
fileSz?: string;
|
|
filePath?: string;
|
|
}
|
|
|
|
export async function fetchManuals(params?: {
|
|
category?: string;
|
|
search?: string;
|
|
}): Promise<ManualItem[]> {
|
|
const response = await api.get<ManualItem[]>('/board/manual', { params });
|
|
return response.data;
|
|
}
|
|
|
|
export async function createManual(input: CreateManualInput): Promise<{ manualSn: number }> {
|
|
const response = await api.post<{ manualSn: number }>('/board/manual', input);
|
|
return response.data;
|
|
}
|
|
|
|
export async function updateManual(sn: number, input: UpdateManualInput): Promise<void> {
|
|
await api.put(`/board/manual/${sn}`, input);
|
|
}
|
|
|
|
export async function deleteManual(sn: number): Promise<void> {
|
|
await api.delete(`/board/manual/${sn}`);
|
|
}
|
|
|
|
export async function incrementManualDownload(sn: number): Promise<void> {
|
|
await api.post(`/board/manual/${sn}/download`);
|
|
}
|