@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
16 lines (15 loc) • 643 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const preBookmarkReportsByRoleId = async (userId, activeCaseLoadId, services, bookmarksByCaseload = {}) => {
const bookmarks = bookmarksByCaseload[activeCaseLoadId] || [];
// Add new automatic bookmarks
for (let index = 0; index < bookmarks.length; index += 1) {
const { reportId, variantId: id } = bookmarks[index];
// eslint-disable-next-line no-await-in-loop
await services.bookmarkService.addBookmark(userId, reportId, id, 'report', true);
}
return bookmarks;
};
exports.default = {
preBookmarkReportsByRoleId,
};