201 lines
5.4 KiB
TypeScript
201 lines
5.4 KiB
TypeScript
import { title } from "process";
|
|
import {
|
|
httpDeleteInterceptor,
|
|
httpGetInterceptor,
|
|
httpPostInterceptor,
|
|
} from "./http-config/http-interceptor-service";
|
|
import { httpGet } from "./http-config/http-base-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[]
|
|
) {
|
|
let statusQuery = "";
|
|
|
|
if (status.includes(1)) {
|
|
statusQuery = "&isDone=true";
|
|
} else if (status.includes(2)) {
|
|
statusQuery = "&isDone=false";
|
|
}
|
|
|
|
return httpGetInterceptor(
|
|
`assignment/list?enablePage=1&size=${size}&page=${page}&title=${title}&taskType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}`
|
|
);
|
|
}
|
|
|
|
export async function listTaskMabesForTa(
|
|
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 httpGet(
|
|
`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 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";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
|
|
export async function deleteTask(id: any) {
|
|
const url = `assignment?id=${id}`;
|
|
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";
|
|
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";
|
|
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 getAcceptanceTa(id: any, isAccept: any) {
|
|
const url = `assignment-expert/acceptance?id=${id}&isAccept=${isAccept}`;
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function acceptAssignment(id: any) {
|
|
const url = `assignment/acceptance?id=${id}`;
|
|
return httpPostInterceptor(url, id);
|
|
}
|
|
|
|
export async function acceptAssignmentTa(id: any) {
|
|
const url = `assignment-expert/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);
|
|
}
|
|
|
|
export async function finishTaskTa(id: any) {
|
|
const url = `assignment-expert/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}&assignmentType=${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);
|
|
}
|