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; } export async function getAssignmentForCompletion( assignmentId: bigint, ): Promise { const params = MakeGeneralIdRefParams(assignmentId); const response = await httpService.get( apiEndpoint + "/getAssignmentDetails?" + params, ); return response?.data; } export async function completeAssignment( assignmentGeneralId: GeneralIdRef, taskData: Record, ): Promise { const request: CompleteAssignmentRequest = { assignmenId: assignmentGeneralId, taskData, }; return await httpService.post(apiEndpoint + "/CompleteAssignmost", request); } const assignmentCompleteService = { getAssignmentForCompletion, completeAssignment, }; export default assignmentCompleteService;