mediahub-fe/service/content/content.ts

245 lines
7.4 KiB
TypeScript

import { httpPost } from "../http-config/http-base-service";
import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
// export async function listDataAll(
// isForSelf,
// isApproval,
// page,
// limit,
// search,
// fileTypeFilter,
// statusFilter,
// startDate,
// endDate,
// needApprovalFromLevel
// ) {
// const name = search || "";
// const url = `media/list?title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&isForSelf=${isForSelf}&isApproval=${isApproval}&typeId=${fileTypeFilter}&statusId=${statusFilter}&startDate=${
// startDate == undefined ? "" : startDate
// }&endDate=${
// endDate == undefined ? "" : endDate
// }&needApprovalFromLevel=${needApprovalFromLevel}`;
// return httpGetInterceptor({ url });
// }
export async function listDataAll(
isForSelf: any,
isApproval: any,
page: any,
limit: any,
search: any,
fileTypeFilter: any,
statusFilter: any,
needApprovalFromLevel: any,
creator: any,
source: any,
startDate: any,
endDate: any,
title: string = ""
) {
return await httpGetInterceptor(
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&isForSelf=${isForSelf}&isApproval=${isApproval}&typeId=${fileTypeFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&title=${title}`
);
}
export async function listDataImage(
size: any = "",
page: any = "",
isForSelf: any = "",
isApproval: any = "",
categoryFilter: any = "",
statusFilter: any = "",
needApprovalFromLevel: any = "",
creator: any = "",
source: any = "",
startDate: any = "",
endDate: any = "",
title: string = "",
creatorGroup: string = "",
isInt: boolean = false
) {
return await httpGetInterceptor(
`media/list?enablePage=1&size=${size}&sortBy=createdAt&sort=desc&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}&needApprovalFromLevel=${needApprovalFromLevel}&isInt=${isInt}`
);
}
export async function listDataVideo(
size: any,
page: any,
isForSelf: any,
isApproval: any,
categoryFilter: any,
statusFilter: any,
needApprovalFromLevel: any,
creator: any,
source: any,
startDate: any,
endDate: any,
title: string = "",
creatorGroup: string = ""
) {
return await httpGetInterceptor(
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${size}&page=${page}&typeId=2&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}`
);
}
export async function listDataTeks(
size: any,
page: any,
isForSelf: any,
isApproval: any,
categoryFilter: any,
statusFilter: any,
needApprovalFromLevel: any,
creator: any,
source: any,
startDate: any,
endDate: any,
title: string = "",
creatorGroup: string = ""
) {
return await httpGetInterceptor(
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${size}&page=${page}&typeId=3&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}`
);
}
export async function listDataAudio(
size: any,
page: any,
isForSelf: any,
isApproval: any,
categoryFilter: any,
statusFilter: any,
needApprovalFromLevel: any,
creator: any,
source: any,
startDate: any,
endDate: any,
title: string = "",
creatorGroup: string = ""
) {
return await httpGetInterceptor(
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${size}&page=${page}&typeId=4&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}&creatorGroupLevelName=${creatorGroup}`
);
}
export async function listSPIT(
size: any,
page: any,
title = "",
contentCreatedDate = "",
isPublish: any
) {
return await httpGetInterceptor(
`media/spit/pagination?enablePage=1&page=${page}&size=${size}&sort=desc&sortBy=contentTitleId&title=${title}&startDate=${contentCreatedDate}&endDate=${contentCreatedDate}&isPublish=${isPublish}`
);
}
export async function deleteBulkSPIT(ids: any) {
const url = `media/spit/bulk?ids=${ids}`;
return httpDeleteInterceptor(url);
}
export async function listNulisAI(limit: any, page: any, title: string = "") {
return await httpGetInterceptor(
`media/nulis-ai/pagination?enablePage=1&page=${page}&size=${limit}&title=${title}`
);
}
export async function getTagsBySubCategoryId(subCategory: any) {
return await httpGetInterceptor(
`media/tags/list?subCategoryId=${subCategory}`
);
}
export async function listEnableCategory(type: any) {
const url = `media/categories/list?enablePage=0&sort=desc&sortBy=id&type=${type}`;
return httpGetInterceptor(url);
}
export async function listCategory(type: any) {
const url = `media/categories/list?enablePage=0&sort=desc&sortBy=id&categoryId=${type}`;
return httpGetInterceptor(url);
}
export async function getTags() {
const url = "media/tags/list";
return httpGetInterceptor(url);
}
export async function createMedia(data: any) {
const url = "media";
return httpPostInterceptor(url, data);
}
export async function updateFilePlacements(data: any) {
const url = "media/file/update-placement";
return httpPostInterceptor(url, data);
}
export async function uploadThumbnail(id: any, data: any) {
const url = `media/upload?id=${id}&operation=thumbnail`;
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, data, headers);
}
export async function detailSPIT(id: any) {
const url = `media/spit?id=${id}`;
return httpGetInterceptor(url);
}
export async function convertSPIT(data: any) {
const url = "media/spit/convert";
return httpPostInterceptor(url, data);
}
export async function submitApproval(data: any) {
const url = "media/approval";
return httpPostInterceptor(url, data);
}
export async function rejectFiles(data: any) {
const url = "media/file/rejects";
return httpPostInterceptor(url, data);
}
export async function publishMedia(id: any) {
const url = `media/public/publish-to-mabes?id=${id}`;
return httpPostInterceptor(url);
}
export async function saveContentRewrite(data: any) {
const url = "media/rewrite";
return httpPostInterceptor(url, data);
}
export async function saveUserReports(data: any) {
const url = "public/users/reports";
return httpPostInterceptor(url, data);
}
export async function deleteMedia(data: any) {
const url = `media`;
return httpDeleteInterceptor(url, data);
}
export async function deleteFile(data: any) {
const url = "media/file";
return httpDeleteInterceptor(url, data);
}
export async function deleteSPIT(id: any) {
const url = `media/spit?id=${id}`;
return httpDeleteInterceptor(url);
}
export async function postActivityLog(data: any) {
const url = `activity`;
return httpPost(url, data);
}