import api, { PageResponse, unwrap } from './request'; export interface NoticeRow extends Record { noticeId: number; title: string; content: string; noticeType: string; // GENERAL / IMPORTANT / SYSTEM isPinned: boolean; authorId: number; authorName: string; viewCount: number; publishedAt?: string; expiresAt?: string; status: string; createdAt: string; } export interface NoticeSaveReq { title: string; content: string; noticeType: string; isPinned: boolean; publishedAt?: string; expiresAt?: string; } export interface NoticeSearchParam { title?: string; noticeType?: string; status?: string; pageNum?: number; pageSize?: number; } export const noticeApi = { list: (p?: NoticeSearchParam) => unwrap>( api.get('/api/notices', { params: p }), ), detail: (id: number) => unwrap(api.get(`/api/notices/${id}`)), create: (body: NoticeSaveReq) => unwrap(api.post('/api/notices', body)), update: (id: number, body: Partial) => unwrap(api.put(`/api/notices/${id}`, body)), delete: (id: number) => unwrap(api.delete(`/api/notices/${id}`)), };