webui/src/modules/manager/tasks/services/tasksService.ts

47 lines
1.1 KiB
TypeScript

import httpService from "../../../../services/httpService";
import { Paginated } from "../../../../services/Paginated";
import { GeneralIdRef } from "../../../../utils/GeneralIdRef";
import MapToJson from "../../../../utils/MapToJson";
const apiEndpoint = "/Tasks";
export interface GetMyAssignments {
Id: bigint;
Guid: string;
taskType: string;
taskName: string;
user?: GeneralIdRef;
role?: GeneralIdRef;
startDateTime?: Date;
}
export async function myTasks(
page: number,
pageSize: number,
sortKey: string,
sortAscending: boolean,
filters?: Map<string, string> | undefined,
): Promise<Paginated<GetMyAssignments>> {
const filterString = MapToJson(filters);
const response = await httpService.get<Paginated<GetMyAssignments>>(
apiEndpoint + "/myTasks",
{
params: {
page: page,
pageSize: pageSize,
sortKey: sortKey,
sortAscending: sortAscending,
filters: filterString,
},
},
);
return response?.data;
}
const tasksService = {
myTasks,
};
export default tasksService;