mediahub-fe/service/task.ts

162 lines
4.4 KiB
TypeScript
Raw Normal View History

import { title } from "process";
import {
2025-01-01 17:48:57 +00:00
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
} from "./http-config/http-interceptor-service";
// export async function listTask(size: number, page: number) {
// return await httpGetInterceptor(
// `assignment/list?enablePage=1&title=${title}&size=${limit}&page=${page}`
// );
// }
export async function listTask(
page: any,
2025-02-05 09:02:13 +00:00
title: string = "",
size: any,
2025-02-05 09:02:13 +00:00
code: any,
createdAt: any,
2025-02-08 03:44:09 +00:00
taskType: string,
status: number[]
) {
2025-02-11 07:00:18 +00:00
let statusQuery = "";
if (status.includes(1)) {
statusQuery = "&isDone=true";
} else if (status.includes(2)) {
statusQuery = "&isDone=false";
}
2025-02-08 03:44:09 +00:00
2025-02-05 09:02:13 +00:00
return httpGetInterceptor(
2025-02-08 03:44:09 +00:00
`assignment/list?enablePage=1&size=${size}&page=${page}&title=${title}&taskType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}`
2025-02-05 09:02:13 +00:00
);
}
2024-12-09 13:17:22 +00:00
// export async function createTask(data: any) {
// const url = "assignment";
// return httpPostInterceptor(url, data);
// }
export async function createTask(data: any) {
2024-12-09 13:17:22 +00:00
const pathUrl = "assignment";
2025-01-01 17:48:57 +00:00
return httpPostInterceptor(pathUrl, data);
}
export async function getTask(id: any) {
const url = `/assignment?id=${id}`;
2025-01-01 17:48:57 +00:00
return httpGetInterceptor(url);
}
export async function getMediaUpload(id: any, userLevelId: any) {
const url = `/assignment/media-uploads?id=${id}&userLevelId=${userLevelId}`;
return httpGetInterceptor(url);
}
export async function getMediaUploadTa(id: any, userLevelId: any) {
const url = `/assignment-expert/media-uploads?id=${id}&userLevelId=${userLevelId}`;
return httpGetInterceptor(url);
}
export async function forwardTask(data: any) {
const url = "assignment/forward";
2025-01-01 17:48:57 +00:00
return httpPostInterceptor(url, data);
}
export async function deleteTask(id: any) {
const url = `assignment?id=${id}`;
2025-01-01 17:48:57 +00:00
return httpDeleteInterceptor(url);
}
export async function deleteTaskTa(id: any) {
const url = `assignment-expert?id=${id}`;
return httpDeleteInterceptor(url);
}
export async function getUserLevelForAssignments() {
const url = "/users/user-levels/assignment";
2025-01-01 17:48:57 +00:00
return httpGetInterceptor(url);
}
export async function getUserLevelForExpert(id: any) {
const url = `/users/assignment-expert?competencyIds=${id}`;
return httpGetInterceptor(url);
}
export async function getAssignmentResponseList(id: any) {
const url = `assignment/response?assignmentId=${id}`;
return httpGetInterceptor(url);
}
export async function createAssignmentResponse(data: any) {
const url = "assignment/response";
2025-01-01 17:48:57 +00:00
return httpPostInterceptor(url, data);
}
export async function deleteAssignmentResponse(id: any) {
const url = `assignment/response?id=${id}`;
2025-01-01 17:48:57 +00:00
return httpDeleteInterceptor(url);
}
export async function getAcceptance(id: any, isAccept: any) {
const url = `assignment/acceptance?id=${id}&isAccept=${isAccept}`;
2025-01-11 14:30:35 +00:00
return httpGetInterceptor(url);
}
2025-05-13 06:05:42 +00:00
export async function acceptAssignment(id: any) {
const url = `assignment/acceptance?id=${id}`;
2025-01-01 17:48:57 +00:00
return httpPostInterceptor(url, id);
}
export async function postFinishAcceptance(id: any) {
const url = `assignment/finish-acceptance?id=${id}`;
2025-01-01 17:48:57 +00:00
return httpPostInterceptor(url, id);
}
export async function getAcceptanceAssignmentStatus(id: any) {
const url = `assignment/acceptance/status?id=${id}`;
2025-01-01 17:48:57 +00:00
return httpGetInterceptor({ url });
}
export async function getListAttachment(assignmentId: any, isForCreator: any) {
const url = `media/list?&enablePage=0&assignmentId=${assignmentId}&isForAdmin=${isForCreator}`;
2025-01-01 17:48:57 +00:00
return httpGetInterceptor({ url });
}
2025-01-11 14:30:35 +00:00
export async function finishTask(id: any) {
const url = `assignment/finish?id=${id}`;
return httpPostInterceptor(url);
}
export async function listTaskTa(
page: any,
title: string = "",
size: any,
code: any,
createdAt: any,
taskType: string,
status: number[]
) {
let statusQuery = "";
if (status.includes(1)) {
statusQuery = "&isDone=true";
} else if (status.includes(2)) {
statusQuery = "&isDone=false";
}
return httpGetInterceptor(
`assignment-expert/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&taskType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}`
);
}
export async function createTaskTa(data: any) {
const pathUrl = "assignment-expert";
return httpPostInterceptor(pathUrl, data);
}
export async function getTaskTa(id: any) {
const url = `/assignment-expert?id=${id}`;
return httpGetInterceptor(url);
}