2024-12-06 18:37:45 +00:00
|
|
|
import { title } from "process";
|
2024-12-04 17:28:40 +00:00
|
|
|
import {
|
2025-01-01 17:48:57 +00:00
|
|
|
httpDeleteInterceptor,
|
2024-12-05 17:02:06 +00:00
|
|
|
httpGetInterceptor,
|
|
|
|
|
httpPostInterceptor,
|
|
|
|
|
} from "./http-config/http-interceptor-service";
|
2024-12-04 17:28:40 +00:00
|
|
|
|
2024-12-06 18:37:45 +00:00
|
|
|
// export async function listTask(size: number, page: number) {
|
|
|
|
|
// return await httpGetInterceptor(
|
|
|
|
|
// `assignment/list?enablePage=1&title=${title}&size=${limit}&page=${page}`
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
2024-12-11 18:28:57 +00:00
|
|
|
export async function listTask(
|
|
|
|
|
page: any,
|
2025-02-05 09:02:13 +00:00
|
|
|
title: string = "",
|
2024-12-11 18:28:57 +00:00
|
|
|
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[]
|
2024-12-11 18:28:57 +00:00
|
|
|
) {
|
2025-02-08 03:44:09 +00:00
|
|
|
const statusQuery = status.length
|
|
|
|
|
? `&isDone=${status.includes(1)}&isActive=${status.includes(2)}`
|
|
|
|
|
: "";
|
|
|
|
|
|
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-05 17:02:06 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-09 13:17:22 +00:00
|
|
|
// export async function createTask(data: any) {
|
|
|
|
|
// const url = "assignment";
|
|
|
|
|
// return httpPostInterceptor(url, data);
|
|
|
|
|
// }
|
|
|
|
|
|
2024-12-05 17:02:06 +00:00
|
|
|
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);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getTask(id: any) {
|
|
|
|
|
const url = `/assignment?id=${id}`;
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpGetInterceptor(url);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
2025-02-04 07:08:45 +00:00
|
|
|
export async function getMediaUpload(id: any, userLevelId: any) {
|
|
|
|
|
const url = `/assignment/media-uploads?id=${id}&userLevelId=${userLevelId}`;
|
|
|
|
|
return httpGetInterceptor(url);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-04 17:28:40 +00:00
|
|
|
export async function forwardTask(data: any) {
|
|
|
|
|
const url = "assignment/forward";
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpPostInterceptor(url, data);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function deleteTask(id: any) {
|
|
|
|
|
const url = `assignment?id=${id}`;
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpDeleteInterceptor(url);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getUserLevelForAssignments() {
|
|
|
|
|
const url = "/users/user-levels/assignment";
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpGetInterceptor(url);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getAssignmentResponseList(id: any) {
|
|
|
|
|
const url = `assignment/response?assignmentId=${id}`;
|
2025-01-09 17:59:20 +00:00
|
|
|
return httpGetInterceptor(url);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function createAssignmentResponse(data: any) {
|
|
|
|
|
const url = "assignment/response";
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpPostInterceptor(url, data);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function deleteAssignmentResponse(id: any) {
|
|
|
|
|
const url = `assignment/response?id=${id}`;
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpDeleteInterceptor(url);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function acceptAssignment(id: any, isAccept: any) {
|
|
|
|
|
const url = `assignment/acceptance?id=${id}`;
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpPostInterceptor(url, id);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getAcceptanceAssignmentStatus(id: any) {
|
|
|
|
|
const url = `assignment/acceptance/status?id=${id}`;
|
2025-01-01 17:48:57 +00:00
|
|
|
return httpGetInterceptor({ url });
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 });
|
2024-12-04 17:28:40 +00:00
|
|
|
}
|
2025-01-11 14:30:35 +00:00
|
|
|
|
|
|
|
|
export async function finishTask(id: any) {
|
|
|
|
|
const url = `assignment/finish?id=${id}`;
|
|
|
|
|
return httpPostInterceptor(url);
|
|
|
|
|
}
|