Remediated test #1 results
This commit is contained in:
@@ -54,7 +54,7 @@ import {
|
||||
} from '../types';
|
||||
|
||||
import { parseFriendlyError, FriendlyError } from '../utils/apiErrorParser';
|
||||
import { registerUserEmail, registerUserEmails } from '../lib/formatters';
|
||||
import { registerUserEmail, registerUserEmails, getUserIdByEmail } from '../lib/formatters';
|
||||
|
||||
// Helper to extract ProblemDetails from Axios error or unknown error
|
||||
export function parseApiError(error: unknown): ProblemDetails {
|
||||
@@ -88,6 +88,20 @@ export const getDashboard = async (): Promise<Dashboard> => {
|
||||
// 2. Governance & Structure APIs
|
||||
// ==========================================
|
||||
|
||||
/**
|
||||
* Ensures an ID is converted to a canonical int64 integer number.
|
||||
* Decodes HashIDs if a HashID string is passed, ensuring request body schemas
|
||||
* (pattern: ^-?(?:0|[1-9]\d*)$) receive numeric integers, never raw HashIDs.
|
||||
*/
|
||||
export const toIntegerId = (id: number | string | null | undefined): number => {
|
||||
return toolsService.decodeToNumberSync(id);
|
||||
};
|
||||
|
||||
export const toNullableIntegerId = (id: number | string | null | undefined): number | null => {
|
||||
if (id === null || id === undefined || id === '') return null;
|
||||
return toolsService.decodeToNumberSync(id);
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalizes an Organisation object from backend responses.
|
||||
* Robustly maps status across variations (status, Status, activityStatus, approvalStatus, statusId, isActive).
|
||||
@@ -137,19 +151,22 @@ export const getOrganisation = async (organisationId: string | number): Promise<
|
||||
};
|
||||
|
||||
export const createOrganisation = async (payload: CreateOrganisationRequest): Promise<Organisation> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/governance/organisations', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
name: payload.name,
|
||||
registrationNo: payload.registrationNo,
|
||||
email: payload.email,
|
||||
type: payload.type !== undefined ? Number(payload.type) : 5,
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateOrganisation = async (payload: UpdateOrganisationRequest): Promise<Organisation> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.put('/v1/api/governance/organisations', {
|
||||
...payload,
|
||||
updatedBy: userSub || undefined,
|
||||
organisationId: toIntegerId(payload.organisationId),
|
||||
name: payload.name,
|
||||
registrationNo: payload.registrationNo,
|
||||
email: payload.email,
|
||||
type: Number(payload.type),
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
@@ -193,20 +210,30 @@ export const getPortfolioProgrammes = async (portfolioId: string | number): Prom
|
||||
|
||||
export const createPortfolio = async (payload: CreatePortfolioRequest): Promise<Portfolio> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
let ownerId = payload.ownerId;
|
||||
if (ownerId && typeof ownerId === 'string' && ownerId.includes('@')) {
|
||||
ownerId = getUserIdByEmail(ownerId) || userSub || ownerId;
|
||||
}
|
||||
const res = await apiClient.post('/v1/api/governance/organisations/portfolio', {
|
||||
...payload,
|
||||
ownerId: payload.ownerId || userSub || undefined,
|
||||
createdBy: userSub || undefined,
|
||||
name: payload.name,
|
||||
description: payload.description,
|
||||
organisationId: toIntegerId(payload.organisationId),
|
||||
ownerId: ownerId || userSub || '00000000-0000-0000-0000-000000000000',
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updatePortfolio = async (payload: UpdatePortfolioRequest): Promise<Portfolio> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
let ownerId = payload.ownerId;
|
||||
if (ownerId && typeof ownerId === 'string' && ownerId.includes('@')) {
|
||||
ownerId = getUserIdByEmail(ownerId) || userSub || ownerId;
|
||||
}
|
||||
const res = await apiClient.put('/v1/api/governance/organisations/portfolio', {
|
||||
...payload,
|
||||
ownerId: payload.ownerId || userSub || undefined,
|
||||
updatedBy: userSub || undefined,
|
||||
portfolioId: toIntegerId(payload.portfolioId),
|
||||
name: payload.name,
|
||||
description: payload.description,
|
||||
ownerId: ownerId || userSub || '00000000-0000-0000-0000-000000000000',
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
@@ -245,20 +272,29 @@ export const getProgrammeProjects = async (programmeId: string | number): Promis
|
||||
|
||||
export const createProgramme = async (payload: CreateProgrammeRequest): Promise<Programme> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
let ownerId = payload.ownerId;
|
||||
if (ownerId && typeof ownerId === 'string' && ownerId.includes('@')) {
|
||||
ownerId = getUserIdByEmail(ownerId) || userSub || ownerId;
|
||||
}
|
||||
const res = await apiClient.post('/v1/api/projects/programme', {
|
||||
...payload,
|
||||
ownerId: payload.ownerId || userSub || undefined,
|
||||
createdBy: userSub || undefined,
|
||||
portfolioId: toIntegerId(payload.portfolioId),
|
||||
name: payload.name,
|
||||
ownerId: ownerId || userSub || '00000000-0000-0000-0000-000000000000',
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateProgramme = async (payload: UpdateProgrammeRequest): Promise<Programme> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
let ownerId = payload.ownerId;
|
||||
if (ownerId && typeof ownerId === 'string' && ownerId.includes('@')) {
|
||||
ownerId = getUserIdByEmail(ownerId) || userSub || ownerId;
|
||||
}
|
||||
const res = await apiClient.put('/v1/api/projects/programme', {
|
||||
...payload,
|
||||
ownerId: payload.ownerId || userSub || undefined,
|
||||
updatedBy: userSub || undefined,
|
||||
programmeId: toIntegerId(payload.programmeId),
|
||||
name: payload.name,
|
||||
ownerId: ownerId || userSub || '00000000-0000-0000-0000-000000000000',
|
||||
status: Number(payload.status) || 1,
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
@@ -277,28 +313,40 @@ export const getProject = async (projectId: string | number): Promise<Project> =
|
||||
};
|
||||
|
||||
export const createProject = async (payload: CreateProjectRequest): Promise<Project> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/projects', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
programmeId: toIntegerId(payload.programmeId),
|
||||
name: payload.name,
|
||||
description: payload.description,
|
||||
sector: Number(payload.sector),
|
||||
projectType: Number(payload.projectType),
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateProject = async (payload: UpdateProjectRequest): Promise<Project> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const startedAt = payload.startedAt
|
||||
? (payload.startedAt.includes('T') ? payload.startedAt : new Date(payload.startedAt).toISOString())
|
||||
: null;
|
||||
const endedAt = payload.endedAt
|
||||
? (payload.endedAt.includes('T') ? payload.endedAt : new Date(payload.endedAt).toISOString())
|
||||
: null;
|
||||
|
||||
const res = await apiClient.put('/v1/api/projects', {
|
||||
...payload,
|
||||
updatedBy: userSub || undefined,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
name: payload.name,
|
||||
description: payload.description,
|
||||
startedAt,
|
||||
endedAt,
|
||||
sector: Number(payload.sector),
|
||||
projectType: Number(payload.projectType),
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateProjectStatus = async (payload: UpdateProjectStatusRequest): Promise<void> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
await apiClient.put('/v1/api/projects/status', {
|
||||
...payload,
|
||||
updatedBy: userSub || undefined,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
status: Number(payload.status),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -315,36 +363,36 @@ export const getActivity = async (activityId: string | number): Promise<Activity
|
||||
};
|
||||
|
||||
export const createActivity = async (payload: CreateActivityRequest): Promise<Activity> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const body: any = {
|
||||
...payload,
|
||||
milestoneId:
|
||||
payload.milestoneId !== undefined && payload.milestoneId !== null && payload.milestoneId !== ''
|
||||
? Number(payload.milestoneId)
|
||||
: null,
|
||||
createdBy: userSub || undefined,
|
||||
const performedAt = payload.performedAt
|
||||
? (payload.performedAt.includes('T') ? payload.performedAt : new Date(payload.performedAt).toISOString())
|
||||
: null;
|
||||
|
||||
const body = {
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
milestoneId: toNullableIntegerId(payload.milestoneId),
|
||||
category: payload.category || 'Operations',
|
||||
amount: Number(payload.amount) || 0,
|
||||
title: payload.title,
|
||||
description: payload.description || '',
|
||||
performedAt,
|
||||
};
|
||||
try {
|
||||
const res = await apiClient.post('/v1/api/projects/activities', body);
|
||||
return res.data;
|
||||
} catch (err: any) {
|
||||
if (err?.response?.status === 405) {
|
||||
const res = await apiClient.put('/v1/api/projects/activities', body);
|
||||
return res.data;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
const res = await apiClient.post('/v1/api/projects/activities', body);
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateActivity = async (payload: UpdateActivityRequest): Promise<Activity> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const body: any = {
|
||||
...payload,
|
||||
milestoneId:
|
||||
payload.milestoneId !== undefined && payload.milestoneId !== null && payload.milestoneId !== ''
|
||||
? Number(payload.milestoneId)
|
||||
: null,
|
||||
updatedBy: userSub || undefined,
|
||||
const performedAt = payload.performedAt
|
||||
? (payload.performedAt.includes('T') ? payload.performedAt : new Date(payload.performedAt).toISOString())
|
||||
: null;
|
||||
|
||||
const body = {
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
milestoneId: toNullableIntegerId(payload.milestoneId),
|
||||
category: payload.category || 'Operations',
|
||||
amount: Number(payload.amount) || 0,
|
||||
title: payload.title,
|
||||
description: payload.description || '',
|
||||
performedAt,
|
||||
};
|
||||
try {
|
||||
const res = await apiClient.put('/v1/api/projects/activities', body);
|
||||
@@ -376,19 +424,30 @@ export const getMilestone = async (milestoneId: string | number): Promise<Milest
|
||||
};
|
||||
|
||||
export const createMilestone = async (payload: CreateMilestoneRequest): Promise<Milestone> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const dueAtIso = payload.dueAt.includes('T')
|
||||
? payload.dueAt
|
||||
: new Date(payload.dueAt).toISOString();
|
||||
|
||||
const res = await apiClient.post('/v1/api/evidence/milestones', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
dueAt: dueAtIso,
|
||||
name: payload.name,
|
||||
priority: Number(payload.priority) || 1,
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateMilestone = async (payload: UpdateMilestoneRequest): Promise<void> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const dueAtIso = payload.dueAt.includes('T')
|
||||
? payload.dueAt
|
||||
: new Date(payload.dueAt).toISOString();
|
||||
|
||||
await apiClient.put('/v1/api/projects/milestone', {
|
||||
...payload,
|
||||
updatedBy: userSub || undefined,
|
||||
milestoneId: toIntegerId(payload.milestoneId),
|
||||
dueAt: dueAtIso,
|
||||
name: payload.name,
|
||||
priority: Number(payload.priority) || 1,
|
||||
status: Number(payload.status) || 1,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -422,10 +481,10 @@ export const getAward = async (awardId: string | number): Promise<Award> => {
|
||||
};
|
||||
|
||||
export const createAward = async (payload: CreateAwardRequest): Promise<Award> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/grants/awards', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
organisationId: toIntegerId(payload.organisationId),
|
||||
programmeId: toIntegerId(payload.programmeId),
|
||||
amount: Number(payload.amount),
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
@@ -456,12 +515,27 @@ export const getContract = async (contractId: string | number): Promise<Contract
|
||||
};
|
||||
|
||||
export const createContract = async (payload: CreateContractRequest): Promise<Contract> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const hashedAwardId = await toolsService.resolveAwardId(payload.awardId);
|
||||
// Ensure awardId is numeric int64 as required by OpenAPI schema (pattern: ^-?(?:0|[1-9]\d*)$)
|
||||
let numericAwardId: number = Number(payload.awardId);
|
||||
if (isNaN(numericAwardId) || !/^-?\d+$/.test(String(payload.awardId))) {
|
||||
const decoded = toolsService.decodeIdSync(String(payload.awardId));
|
||||
if (decoded && /^-?\d+$/.test(String(decoded))) {
|
||||
numericAwardId = Number(decoded);
|
||||
}
|
||||
}
|
||||
|
||||
const effectiveAtIso = payload.effectiveAt.includes('T')
|
||||
? payload.effectiveAt
|
||||
: new Date(payload.effectiveAt).toISOString();
|
||||
const expiresAtIso = payload.expiresAt.includes('T')
|
||||
? payload.expiresAt
|
||||
: new Date(payload.expiresAt).toISOString();
|
||||
|
||||
const res = await apiClient.post('/v1/api/grants/contracts', {
|
||||
...payload,
|
||||
awardId: hashedAwardId,
|
||||
createdBy: userSub || undefined,
|
||||
awardId: !isNaN(numericAwardId) ? numericAwardId : payload.awardId,
|
||||
totalValue: Number(payload.totalValue),
|
||||
effectiveAt: effectiveAtIso,
|
||||
expiresAt: expiresAtIso,
|
||||
});
|
||||
|
||||
// Extract ID from headers (e.g. Location or Content-Location) if present
|
||||
@@ -472,6 +546,8 @@ export const createContract = async (payload: CreateContractRequest): Promise<Co
|
||||
headerId = parts[parts.length - 1];
|
||||
}
|
||||
|
||||
const hashedAwardId = toolsService.encodeIdSync(numericAwardId || payload.awardId);
|
||||
|
||||
// Case 1: Backend returns string contractId/hash directly
|
||||
if (typeof res.data === 'string' && res.data.trim().length > 0) {
|
||||
const rawStr = res.data.trim();
|
||||
@@ -479,9 +555,9 @@ export const createContract = async (payload: CreateContractRequest): Promise<Co
|
||||
id: rawStr,
|
||||
contractId: rawStr,
|
||||
awardId: hashedAwardId,
|
||||
totalValue: payload.totalValue,
|
||||
effectiveAt: payload.effectiveAt,
|
||||
expiresAt: payload.expiresAt,
|
||||
totalValue: Number(payload.totalValue),
|
||||
effectiveAt: effectiveAtIso,
|
||||
expiresAt: expiresAtIso,
|
||||
status: ContractStatus.Draft,
|
||||
} as unknown as Contract;
|
||||
}
|
||||
@@ -510,9 +586,9 @@ export const createContract = async (payload: CreateContractRequest): Promise<Co
|
||||
id: headerId,
|
||||
contractId: headerId,
|
||||
awardId: hashedAwardId,
|
||||
totalValue: payload.totalValue,
|
||||
effectiveAt: payload.effectiveAt,
|
||||
expiresAt: payload.expiresAt,
|
||||
totalValue: Number(payload.totalValue),
|
||||
effectiveAt: effectiveAtIso,
|
||||
expiresAt: expiresAtIso,
|
||||
status: ContractStatus.Draft,
|
||||
} as unknown as Contract;
|
||||
}
|
||||
@@ -523,6 +599,7 @@ export const createContract = async (payload: CreateContractRequest): Promise<Co
|
||||
const matched = existing.find(
|
||||
(c) =>
|
||||
String(c.awardId) === String(hashedAwardId) ||
|
||||
String(c.awardId) === String(numericAwardId) ||
|
||||
String(c.awardId) === String(payload.awardId)
|
||||
);
|
||||
if (matched) return matched;
|
||||
@@ -532,18 +609,17 @@ export const createContract = async (payload: CreateContractRequest): Promise<Co
|
||||
id: hashedAwardId,
|
||||
contractId: hashedAwardId,
|
||||
awardId: hashedAwardId,
|
||||
totalValue: payload.totalValue,
|
||||
effectiveAt: payload.effectiveAt,
|
||||
expiresAt: payload.expiresAt,
|
||||
totalValue: Number(payload.totalValue),
|
||||
effectiveAt: effectiveAtIso,
|
||||
expiresAt: expiresAtIso,
|
||||
status: ContractStatus.Draft,
|
||||
}) as unknown as Contract;
|
||||
};
|
||||
|
||||
export const updateContract = async (payload: UpdateContractRequest): Promise<void> => {
|
||||
const hashedContractId = await toolsService.resolveContractId(payload.contractId);
|
||||
await apiClient.put('/v1/api/grants/contracts', {
|
||||
...payload,
|
||||
contractId: hashedContractId,
|
||||
contractId: toIntegerId(payload.contractId),
|
||||
status: Number(payload.status),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -571,12 +647,10 @@ export const getContractSecureLink = async (contractId: string | number): Promis
|
||||
};
|
||||
|
||||
export const executeContract = async (payload: ExecuteContractRequest): Promise<void> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const hashedContractId = await toolsService.resolveContractId(payload.contractId);
|
||||
await apiClient.post('/v1/api/grants/contracts/execute', {
|
||||
...payload,
|
||||
contractId: hashedContractId,
|
||||
executedBy: userSub || undefined,
|
||||
contractId: toIntegerId(payload.contractId),
|
||||
externalSignatureId: payload.externalSignatureId,
|
||||
signedDocumentUrl: payload.signedDocumentUrl,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -594,10 +668,10 @@ export const getBudget = async (budgetId: string | number): Promise<Budget> => {
|
||||
};
|
||||
|
||||
export const createBudget = async (payload: CreateBudgetRequest): Promise<Budget> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/grants/budgets', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
name: payload.name,
|
||||
amount: Number(payload.amount),
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
@@ -619,28 +693,25 @@ export const getDisbursement = async (disbursementId: string | number): Promise<
|
||||
};
|
||||
|
||||
export const createDisbursement = async (payload: CreateDisbursementRequest): Promise<Disbursement> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/execution/disbursements', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
milestoneId: toNullableIntegerId(payload.milestoneId),
|
||||
amount: Number(payload.amount),
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const updateDisbursement = async (payload: UpdateDisbursementRequest): Promise<void> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
await apiClient.put('/v1/api/execution/disbursements', {
|
||||
...payload,
|
||||
updatedBy: userSub || undefined,
|
||||
disbursementId: toIntegerId(payload.disbursementId),
|
||||
milestoneId: toNullableIntegerId(payload.milestoneId),
|
||||
amount: Number(payload.amount),
|
||||
});
|
||||
};
|
||||
|
||||
export const approveDisbursement = async (disbursementId: string | number): Promise<void> => {
|
||||
const hashedDisbId = await toolsService.encodeId(disbursementId);
|
||||
const userSub = getCurrentUserSub();
|
||||
await apiClient.post(`/v1/api/execution/disbursements/${hashedDisbId}/approve`, {
|
||||
approvedBy: userSub || undefined,
|
||||
});
|
||||
await apiClient.post(`/v1/api/execution/disbursements/${hashedDisbId}/approve`, {});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -706,23 +777,23 @@ export const getRisk = async (riskId: string | number): Promise<Risk> => {
|
||||
};
|
||||
|
||||
export const createRisk = async (payload: CreateRiskRequest): Promise<Risk> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/execution/risks', {
|
||||
...payload,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
likelihood: Number(payload.likelihood),
|
||||
impact: Number(payload.impact),
|
||||
createdBy: userSub || undefined,
|
||||
name: payload.name,
|
||||
description: payload.description || '',
|
||||
});
|
||||
return normalizeRisk(res.data);
|
||||
};
|
||||
|
||||
export const updateRisk = async (payload: UpdateRiskRequest): Promise<void> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
await apiClient.put('/v1/api/execution/risks', {
|
||||
...payload,
|
||||
riskId: toIntegerId(payload.riskId),
|
||||
likelihood: Number(payload.likelihood),
|
||||
impact: Number(payload.impact),
|
||||
updatedBy: userSub || undefined,
|
||||
name: payload.name,
|
||||
description: payload.description || '',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -741,20 +812,19 @@ export const getIndicator = async (indicatorId: string | number): Promise<Indica
|
||||
};
|
||||
|
||||
export const createIndicator = async (payload: CreateIndicatorRequest): Promise<Indicator> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post('/v1/api/evidence/indicators', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
projectId: toIntegerId(payload.projectId),
|
||||
name: payload.name,
|
||||
unitOfMeasure: Number(payload.unitOfMeasure) || 1,
|
||||
baselineAmount: Number(payload.baselineAmount) || 0,
|
||||
targetAmount: Number(payload.targetAmount) || 0,
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const recordIndicatorActual = async (indicatorId: string | number, actualAmount: number): Promise<void> => {
|
||||
const hashedIndId = await toolsService.encodeId(indicatorId);
|
||||
const userSub = getCurrentUserSub();
|
||||
await apiClient.post(`/v1/api/evidence/indicators/${hashedIndId}/actuals/${actualAmount}`, {
|
||||
recordedBy: userSub || undefined,
|
||||
});
|
||||
await apiClient.post(`/v1/api/evidence/indicators/${hashedIndId}/actuals/${actualAmount}`, {});
|
||||
};
|
||||
|
||||
export const getEvidenceFiles = async (page = 1, pageSize = 100): Promise<Evidence[]> => {
|
||||
@@ -802,10 +872,11 @@ export const uploadEvidenceFile = async (formData: FormData): Promise<Evidence>
|
||||
};
|
||||
|
||||
export const updateEvidence = async (payload: UpdateEvidenceRequest): Promise<void> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
await apiClient.put('/v1/api/evidence', {
|
||||
...payload,
|
||||
updatedBy: userSub || undefined,
|
||||
evidenceId: toIntegerId(payload.evidenceId),
|
||||
version: Number(payload.version) || 1,
|
||||
evidenceType: Number(payload.evidenceType),
|
||||
status: Number(payload.status),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -910,10 +981,14 @@ export const syncIntegration = async (force = true): Promise<void> => {
|
||||
// 8. Communications & Invites APIs
|
||||
// ==========================================
|
||||
export const sendInvite = async (payload: InviteRequest): Promise<Invite> => {
|
||||
const userSub = getCurrentUserSub();
|
||||
const res = await apiClient.post<Invite>('/v1/api/communications/invite', {
|
||||
...payload,
|
||||
createdBy: userSub || undefined,
|
||||
organisationId: toIntegerId(payload.organisationId),
|
||||
invitedOrganisationId: toIntegerId(payload.invitedOrganisationId),
|
||||
awardId: toIntegerId(payload.awardId),
|
||||
contractId: toIntegerId(payload.contractId),
|
||||
recipient: payload.recipient,
|
||||
message: payload.message,
|
||||
platform: payload.platform !== undefined ? Number(payload.platform) : 1,
|
||||
});
|
||||
return res.data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user