78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import httpService from "../../../../../services/httpService";
|
|
import {
|
|
GeneralIdRef,
|
|
MakeGeneralIdRefParams,
|
|
} from "../../../../../utils/GeneralIdRef";
|
|
import { ReadWorkflowTemplateVersion } from "../../../workflowTemplates/services/WorkflowTemplateService";
|
|
|
|
const apiEndpoint = "/Tasks";
|
|
|
|
export interface GetAssignment {
|
|
id: bigint;
|
|
guid: string;
|
|
startDateTime: Date;
|
|
raci: string;
|
|
allowNoVerdict: boolean;
|
|
outcomes: string[];
|
|
roleId: GeneralIdRef;
|
|
userId: GeneralIdRef;
|
|
comments: string;
|
|
}
|
|
|
|
export interface GetTask {
|
|
id: bigint;
|
|
guid: string;
|
|
taskName: string;
|
|
taskType: string;
|
|
taskGuid: string;
|
|
}
|
|
|
|
export interface GetActivity {
|
|
id: bigint;
|
|
guid: string;
|
|
name: string;
|
|
workflowVersionId: bigint;
|
|
}
|
|
|
|
export interface GetAssignmentForCompletion {
|
|
assignment: GetAssignment;
|
|
task: GetTask;
|
|
activity: GetActivity;
|
|
workflowTemplateVersion: ReadWorkflowTemplateVersion;
|
|
}
|
|
|
|
export interface CompleteAssignmentRequest {
|
|
assignmenId: GeneralIdRef;
|
|
taskData: Record<string, unknown>;
|
|
}
|
|
|
|
export async function getAssignmentForCompletion(
|
|
assignmentId: bigint,
|
|
): Promise<GetAssignmentForCompletion> {
|
|
const params = MakeGeneralIdRefParams(assignmentId);
|
|
|
|
const response = await httpService.get<GetAssignmentForCompletion>(
|
|
apiEndpoint + "/getAssignmentDetails?" + params,
|
|
);
|
|
return response?.data;
|
|
}
|
|
|
|
export async function completeAssignment(
|
|
assignmentGeneralId: GeneralIdRef,
|
|
taskData: Record<string, unknown>,
|
|
): Promise<any> {
|
|
const request: CompleteAssignmentRequest = {
|
|
assignmenId: assignmentGeneralId,
|
|
taskData,
|
|
};
|
|
|
|
return await httpService.post(apiEndpoint + "/CompleteAssignmost", request);
|
|
}
|
|
|
|
const assignmentCompleteService = {
|
|
getAssignmentForCompletion,
|
|
completeAssignment,
|
|
};
|
|
|
|
export default assignmentCompleteService;
|