Files
frontend/apps/cm/src/pages/dashboard/api/schedule-service.ts
T
2025-12-17 14:39:53 +09:00

67 lines
1.4 KiB
TypeScript

import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageableList } from "@/shared/model";
export interface ScheduleParams {
siteId?: string;
schdlTtl?: string;
schdlSeCd?: string;
schdlBgngYmd?: string;
schdlEndYmd?: string;
reptYn?: string;
commSchdlYn?: string;
}
export interface Schedule {
schdlSn: number;
siteId: string;
schdlTtl: string;
schdlSeCd: string;
schdlSeNm?: string;
schdlBgngDt: string;
schdlEndDt: string;
reptYn: string;
commSchdlYn: string;
schdlCn?: string;
actualDate?: string;
atflCd?: string | null;
}
export const getScheduleList = async (params?: ScheduleParams): Promise<PageableList<Schedule>> => {
const response = await client.get<Schedule[]>(
ENDPOINT.CMS_SERVICE.SCHEDULES,
{ params },
);
const data = response.data;
return {
content: data as Schedule[],
pageable: {
sort: {
sorted: false,
unsorted: true,
empty: true,
},
offset: 0,
pageNumber: 0,
pageSize: data.length as number,
paged: false,
unpaged: true,
},
sort: {
sorted: false,
unsorted: true,
empty: true,
},
totalPages: 1,
totalElements: data.length,
number: 0,
numberOfElements: data.length,
size: data.length,
first: true,
last: true,
empty: data.length === 0,
};
};