mediahub-fe/service/schedule/schedule.ts

111 lines
3.0 KiB
TypeScript

import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
import { httpGet } from "../http-config/http-base-service";
import { any } from "zod";
export async function paginationSchedule(
size: any,
page: number,
type: any,
title: string = "",
statusFilter: number[] = []
) {
const statusQuery =
statusFilter.length > 0 ? `&statusId=${statusFilter.join(",")}` : "";
return await httpGetInterceptor(
`schedule/pagination?enablePage=1&scheduleTypeId=${type}&page=${page}&size=${size}&title=${title}${statusQuery}`
);
}
export async function paginationCalendar(
size: any,
page: number,
type: any,
title: string = "",
statusFilter: number[] = []
) {
const statusQuery =
statusFilter.length > 0 ? `&statusId=${statusFilter.join(",")}` : "";
return await httpGetInterceptor(
`calendars/pagination?enablePage=1&scheduleTypeId=${type}&page=${page}&size=${size}&title=${title}${statusQuery}`
);
}
export async function postSchedule(data: any) {
const url = "schedule";
return httpPostInterceptor(url, data);
}
export async function deleteSchedule(id: string | number) {
const url = `schedule?id=${id}`;
return httpDeleteInterceptor(url);
}
export async function detailSchedule(id: any) {
const url = `public/schedule?id=${id}`;
return httpGetInterceptor(url);
}
export async function listScheduleTodayPublic(group = null) {
const url = `public/schedule/today?group=${group}`;
return httpGet(url, null);
}
export async function listScheduleNextPublic(group = null) {
const url = `public/schedule/next-activity?group=${group}`;
return httpGet(url, null);
}
export async function listSchedulePrevPublic(group = null) {
const url = `public/schedule/prev-activity?group=${group}`;
return httpGet(url, null);
}
export async function listSchedule(group = null) {
const url = `public/schedule/list?group=${group}`;
return httpGet(url, null);
}
export async function searchSchedules(search = null) {
const url = `public/schedule/list?search=${search}`;
return httpGet(url, null);
}
export async function listScheduleToday() {
const url = "schedule/today";
return httpGetInterceptor(url);
}
export async function getListScheduleAttachment(scheduleId: any) {
const url = `media/list?&enablePage=0&scheduleId=${scheduleId}`;
return httpGetInterceptor(url);
}
export async function listScheduleNext() {
const url = "schedule/next-activity";
return httpGetInterceptor(url);
}
export async function postCalendar(data: any) {
const url = "calendars";
return httpPostInterceptor(url, data);
}
export async function detailCalendar(id: any) {
const url = `calendars?id=${id}`;
return httpGetInterceptor(url);
}
export async function deleteCalendar(id: any) {
const url = `calendars?id=${id}`;
return httpDeleteInterceptor(url);
}
export async function postApprovalSchedule(data: any) {
const url = "schedule/approval";
return httpPostInterceptor(url, data);
}