111 lines
3.1 KiB
TypeScript
111 lines
3.1 KiB
TypeScript
import { title } from "process";
|
|
import {
|
|
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,
|
|
title: string = "",
|
|
size: any,
|
|
code: any,
|
|
createdAt: any,
|
|
taskType: string,
|
|
status: number[]
|
|
) {
|
|
const statusQuery = status.length
|
|
? `&isDone=${status.includes(1)}&isActive=${status.includes(2)}`
|
|
: "";
|
|
|
|
return httpGetInterceptor(
|
|
`assignment/list?enablePage=1&size=${size}&page=${page}&title=${title}&taskType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}`
|
|
);
|
|
}
|
|
|
|
// export async function createTask(data: any) {
|
|
// const url = "assignment";
|
|
// return httpPostInterceptor(url, data);
|
|
// }
|
|
|
|
export async function createTask(data: any) {
|
|
const pathUrl = "assignment";
|
|
return httpPostInterceptor(pathUrl, data);
|
|
}
|
|
|
|
export async function getTask(id: any) {
|
|
const url = `/assignment?id=${id}`;
|
|
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 forwardTask(data: any) {
|
|
const url = "assignment/forward";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
|
|
export async function deleteTask(id: any) {
|
|
const url = `assignment?id=${id}`;
|
|
return httpDeleteInterceptor(url);
|
|
}
|
|
|
|
export async function getUserLevelForAssignments() {
|
|
const url = "/users/user-levels/assignment";
|
|
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";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
|
|
export async function deleteAssignmentResponse(id: any) {
|
|
const url = `assignment/response?id=${id}`;
|
|
return httpDeleteInterceptor(url);
|
|
}
|
|
|
|
export async function getAcceptance(id: any, isAccept: any) {
|
|
const url = `assignment/acceptance?id=${id}&isAccept=${isAccept}`;
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function acceptAssignment(id: any, isAccept: any) {
|
|
const url = `assignment/acceptance?id=${id}`;
|
|
return httpPostInterceptor(url, id);
|
|
}
|
|
|
|
export async function postFinishAcceptance(id: any) {
|
|
const url = `assignment/finish-acceptance?id=${id}`;
|
|
return httpPostInterceptor(url, id);
|
|
}
|
|
|
|
export async function getAcceptanceAssignmentStatus(id: any) {
|
|
const url = `assignment/acceptance/status?id=${id}`;
|
|
return httpGetInterceptor({ url });
|
|
}
|
|
|
|
export async function getListAttachment(assignmentId: any, isForCreator: any) {
|
|
const url = `media/list?&enablePage=0&assignmentId=${assignmentId}&isForAdmin=${isForCreator}`;
|
|
return httpGetInterceptor({ url });
|
|
}
|
|
|
|
export async function finishTask(id: any) {
|
|
const url = `assignment/finish?id=${id}`;
|
|
return httpPostInterceptor(url);
|
|
}
|