From a47aebf50a5aa5839dcdd41c3786c27ab823d25d Mon Sep 17 00:00:00 2001 From: Bangbay Siboliban Date: Tue, 12 Nov 2024 16:44:40 -0500 Subject: [PATCH] Use ReportShape --- .../src/utils/api/requestMethods/report.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/services/ui-src/src/utils/api/requestMethods/report.ts b/services/ui-src/src/utils/api/requestMethods/report.ts index 9a7798463..77938b300 100644 --- a/services/ui-src/src/utils/api/requestMethods/report.ts +++ b/services/ui-src/src/utils/api/requestMethods/report.ts @@ -1,67 +1,67 @@ -import { AnyObject, ReportKeys } from "types"; +import { ReportKeys, ReportShape } from "types"; import { get, post, put } from "utils"; async function archiveReport(reportKeys: ReportKeys) { const { reportType, state, id } = reportKeys; const path = `/reports/archive/${reportType}/${state}/${id}`; - return put(path); + return put(path); } async function getReportsByState(reportType: string, state: string) { const path = `/reports/${reportType}/${state}`; - return get(path); + return get(path); } async function getReport(reportKeys: ReportKeys) { const { reportType, state, id } = reportKeys; const path = `/reports/${reportType}/${state}/${id}`; - return get(path); + return get(path); } /** - * @todo Swap report from AnyObject to a ReportMetaData + FieldData type + * @todo Swap report from ReportShape to a ReportMetaData + FieldData type */ async function postReport( reportType: string, state: string, - report: AnyObject + report: ReportShape ) { const options: any = { body: { ...report }, }; const path = `/reports/${reportType}/${state}`; - return post(path, options); + return post(path, options); } -async function putReport(reportKeys: ReportKeys, report: AnyObject) { +async function putReport(reportKeys: ReportKeys, report: ReportShape) { const options: any = { body: { ...report }, }; const { reportType, state, id } = reportKeys; const path = `/reports/${reportType}/${state}/${id}`; - return put(path, options); + return put(path, options); } async function releaseReport(reportKeys: ReportKeys) { const { reportType, state, id } = reportKeys; const path = `/reports/release/${reportType}/${state}/${id}`; - return put(path); + return put(path); } async function submitReport(reportKeys: ReportKeys) { const { reportType, state, id } = reportKeys; const path = `/reports/submit/${reportType}/${state}/${id}`; - return post(path); + return post(path); } -async function approveReport(reportKeys: ReportKeys, report: AnyObject) { +async function approveReport(reportKeys: ReportKeys, report: ReportShape) { const options: any = { body: { ...report }, }; const { reportType, state, id } = reportKeys; const path = `/reports/approve/${reportType}/${state}/${id}`; - return put(path, options); + return put(path, options); } export {