@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
55 lines (53 loc) • 1.39 kB
JavaScript
class StoreItemBuilder {
res;
executionData;
childExecutionData;
syncUrl;
queryData;
reportType;
constructor(res) {
this.res = res;
//
}
withExecutionData = (executionData) => {
this.executionData = executionData;
return this;
};
withChildExecutionData = (childExecutionData = []) => {
this.childExecutionData = childExecutionData;
return this;
};
withSyncUrls = (url) => {
this.syncUrl = url;
return this;
};
withQueryData = (queryData) => {
this.queryData = queryData;
return this;
};
// Builders
buildReportMetaData = (reportData) => {
const { reportId, id, reportName, name, description, schedule, type } = reportData;
this.reportType = type;
return {
type: this.reportType,
reportId,
reportName,
description,
id,
name,
...(schedule && { schedule }),
};
};
buidDefinitionsPath = () => {
const { definitionsPath, dpdPathFromQuery } = this.res.locals;
if (!definitionsPath)
return undefined;
return {
dataProductDefinitionsPath: definitionsPath,
dpdPathFromQuery,
};
};
}
export { StoreItemBuilder };
//# sourceMappingURL=builder.js.map