2026-01-09 21:56:32 +09:00
|
|
|
/**
|
|
|
|
|
* 일정 관련 공개 API
|
|
|
|
|
*/
|
2026-01-09 22:02:04 +09:00
|
|
|
import { fetchApi } from "../index";
|
|
|
|
|
import { getTodayKST } from "../../utils/date";
|
2026-01-09 21:56:32 +09:00
|
|
|
|
|
|
|
|
// 일정 목록 조회 (월별)
|
|
|
|
|
export async function getSchedules(year, month) {
|
|
|
|
|
return fetchApi(`/api/schedules?year=${year}&month=${month}`);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 22:02:04 +09:00
|
|
|
// 다가오는 일정 조회 (오늘 이후)
|
|
|
|
|
export async function getUpcomingSchedules(limit = 3) {
|
|
|
|
|
const todayStr = getTodayKST();
|
|
|
|
|
return fetchApi(`/api/schedules?startDate=${todayStr}&limit=${limit}`);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 21:56:32 +09:00
|
|
|
// 일정 검색 (Meilisearch)
|
|
|
|
|
export async function searchSchedules(query, { offset = 0, limit = 20 } = {}) {
|
|
|
|
|
return fetchApi(
|
|
|
|
|
`/api/schedules?search=${encodeURIComponent(
|
|
|
|
|
query
|
|
|
|
|
)}&offset=${offset}&limit=${limit}`
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 일정 상세 조회
|
|
|
|
|
export async function getSchedule(id) {
|
|
|
|
|
return fetchApi(`/api/schedules/${id}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 카테고리 목록 조회
|
|
|
|
|
export async function getCategories() {
|
|
|
|
|
return fetchApi("/api/schedule-categories");
|
|
|
|
|
}
|