jaecoo-kelapagading/service/galery.ts

115 lines
3.0 KiB
TypeScript
Raw Normal View History

2025-11-18 06:56:39 +00:00
import { PaginationRequest } from "@/types/globals";
import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
httpPutInterceptor,
} from "./http-config/http-interceptor-services";
import { httpGet } from "./http-config/http-base-services";
export async function getGaleryData(props: PaginationRequest) {
2025-11-20 06:57:16 +00:00
const { page, limit, search } = props;
return await httpGetInterceptor(`/galleries`);
}
export async function getGaleryFileData(props: PaginationRequest) {
2025-11-18 06:56:39 +00:00
const { page, limit, search } = props;
return await httpGetInterceptor(`/gallery-files`);
}
export async function getGaleryById(id: any) {
const headers = {
"content-type": "application/json",
};
2025-11-20 06:57:16 +00:00
return await httpGet(`/galleries/${id}`, headers);
}
export async function getGaleryFileName(filename: any) {
const headers = {
"content-type": "application/json",
};
return await httpGet(`/gallery-files/viewer/${filename}`, headers);
2025-11-18 06:56:39 +00:00
}
export async function createGalery(data: any) {
2025-11-20 06:57:16 +00:00
const pathUrl = `/galleries`;
return await httpPostInterceptor(pathUrl, data);
}
export async function updateGalery(id: any, data: any) {
2025-11-18 06:56:39 +00:00
const headers = {
"content-type": "multipart/form-data",
};
2025-11-20 06:57:16 +00:00
return await httpPutInterceptor(`/galleries/${id}`, data, headers);
2025-11-18 06:56:39 +00:00
}
2025-11-20 06:57:16 +00:00
export async function updateUploadGaleryFile(id: any, data: any) {
2025-11-18 06:56:39 +00:00
const headers = {
"content-type": "multipart/form-data",
};
return await httpPutInterceptor(`/gallery-files/${id}`, data, headers);
}
2025-11-20 06:57:16 +00:00
export async function uploadGaleryFile(id: any, data: any) {
const headers = {
"content-type": "multipart/form-data",
};
return await httpPostInterceptor(`/gallery-files/`, data, headers);
}
2025-11-18 06:56:39 +00:00
export async function deleteGalery(id: string) {
const headers = {
"content-type": "application/json",
};
2025-11-20 06:57:16 +00:00
return await httpDeleteInterceptor(`galleries/${id}`, headers);
2025-11-18 06:56:39 +00:00
}
2025-11-23 16:42:28 +00:00
export async function deleteGaleryFile(id: any) {
const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`gallery-files/${id}`, headers);
}
2026-01-20 01:04:42 +00:00
export async function approveGalery(id: string | number) {
const headers = {
"content-type": "application/json",
};
return await httpPutInterceptor(`/galleries/${id}/approve`, {}, headers);
2026-01-20 03:35:33 +00:00
}
export async function rejectGalery(id: string | number, message?: string) {
const headers = {
"content-type": "application/json",
};
return await httpPutInterceptor(
`/galleries/${id}/reject`,
{ message },
headers,
);
2026-01-20 03:35:33 +00:00
}
2026-01-26 07:43:25 +00:00
export async function commentGalery(id: string | number, message?: string) {
const headers = {
"content-type": "application/json",
};
return await httpPutInterceptor(
`/galleries/${id}/comment`,
{ message },
headers,
);
}
export async function getApprovalHistory(
moduleType: string,
moduleId: string | number,
) {
2026-01-20 03:35:33 +00:00
const headers = {
"content-type": "application/json",
};
return await httpGet(
`/approval-histories/${moduleType}/${moduleId}`,
headers,
);
}