@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
45 lines (44 loc) • 2.3 kB
TypeScript
import UserDataStore from '../../../../data/reportDataStore';
import { RequestedReport, RequestStatus, StoredReportData } from '../../../../types/UserReports';
import ReportStoreService from '../../../../services/reportStoreService';
import { ReportStoreConfig } from '../../../../types/ReportStore';
declare class RequestedReportService extends ReportStoreService {
constructor(userDataStore: UserDataStore);
addReport(userId: string, reportStateData: RequestedReport): Promise<void>;
removeReport(executionId: string, userId: string): Promise<void>;
getReportByExecutionId(id: string, userId: string): Promise<RequestedReport | undefined>;
getReportByTableId(id: string, userId: string): Promise<RequestedReport | undefined>;
getAllReports(userId: string): Promise<RequestedReport[]>;
updateLastViewed(id: string, userId: string): Promise<void>;
updateStatus(id: string, userId: string, status: RequestStatus, errorMessage?: string): Promise<void>;
setToExpired(id: string, userId: string): Promise<void>;
setToExpiredByTableId(id: string, userId: string): Promise<void>;
saveExpiredState(userConfig: ReportStoreConfig, index: number, userId: string): Promise<void>;
/**
* Removes old stale data from requested reports
* - When a report is viewed it is given a lastViewed ts.
* - If the requested data has a lastViewed ts and
* - has no corresponding viewed entry
* - then that requested data is stale and can be removed
*
* @param {string} userId
* @param {StoredReportData[]} viewedReports
* @memberof RequestedReportService
*/
cleanList(userId: string, viewedReports: StoredReportData[]): Promise<void>;
setReportUrl(report: RequestedReport): {
pathname: string | undefined;
fullUrl: string | undefined;
};
updateDataByStatus(report: RequestedReport, status?: RequestStatus | undefined, errorMessage?: string): RequestedReport;
/**
* Remove duplicate report from state
*
* @param {RequestedReport[]} reports
* @return {*} {RequestedReport[]}
* @memberof RequestedReportService
*/
removeDuplicateRequestedReports: (userId: string) => Promise<string[]>;
}
export { RequestedReportService };
export default RequestedReportService;