@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.22.3 → 4.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dpr/components/bookmark-toggle/clientClass.mjs +5 -2
- package/dpr/components/user-reports/requested/clientClass.mjs +1 -1
- package/dpr/components/user-reports/viewed/clientClass.mjs +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/service.js +3 -3
- package/dpr/routes/journeys/my-reports/bookmarks/service.js.map +3 -3
- package/dpr/routes/journeys/my-reports/bookmarks/service.ts +4 -4
- package/dpr/routes/journeys/my-reports/recently-viewed/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/recently-viewed/controller.js.map +2 -2
- package/dpr/routes/journeys/my-reports/recently-viewed/controller.ts +1 -1
- package/dpr/routes/journeys/my-reports/recently-viewed/routes.js +1 -1
- package/dpr/routes/journeys/my-reports/recently-viewed/routes.js.map +2 -2
- package/dpr/routes/journeys/my-reports/recently-viewed/routes.ts +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/controller.js.map +2 -2
- package/dpr/routes/journeys/my-reports/requested-reports/controller.ts +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/routes.js +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/routes.js.map +2 -2
- package/dpr/routes/journeys/my-reports/requested-reports/routes.ts +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,6 @@ class BookmarkToggle extends DprClientClass {
|
|
|
18
18
|
const id = bookmarkToggle.getAttribute('data-id')
|
|
19
19
|
const reportType = bookmarkToggle.getAttribute('data-report-type')
|
|
20
20
|
this.baseUrl = bookmarkToggle.getAttribute('data-base-url')
|
|
21
|
-
|
|
22
21
|
this.bookmarkWrapper = bookmarkToggle.parentNode
|
|
23
22
|
this.bookmarkColumn = this.bookmarkWrapper.parentNode
|
|
24
23
|
this.bookmarkLabel = this.bookmarkWrapper.querySelector('.dpr-bookmark-label--component')
|
|
@@ -69,7 +68,11 @@ class BookmarkToggle extends DprClientClass {
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
async toggleBookmark(type, id, reportId, reportType, csrfToken) {
|
|
72
|
-
const endpoint =
|
|
71
|
+
const endpoint =
|
|
72
|
+
this.baseUrl && this.baseUrl !== 'undefined'
|
|
73
|
+
? `${this.baseUrl}/dpr/my-reports/bookmarks/`
|
|
74
|
+
: `/dpr/my-reports/bookmarks/`
|
|
75
|
+
|
|
73
76
|
await fetch(endpoint, {
|
|
74
77
|
method: 'post',
|
|
75
78
|
headers: {
|
|
@@ -96,7 +96,7 @@ class DprAsyncRequestList extends DprPollingStatusClass {
|
|
|
96
96
|
async removeItemFromList(executionId) {
|
|
97
97
|
let response
|
|
98
98
|
await fetch(`dpr/my-reports/requested-reports/${executionId}`, {
|
|
99
|
-
method: '
|
|
99
|
+
method: 'post',
|
|
100
100
|
headers: {
|
|
101
101
|
Accept: 'application/json',
|
|
102
102
|
'Content-Type': 'application/json',
|
|
@@ -58,7 +58,7 @@ class DprRecentlyViewedList extends DprPollingStatusClass {
|
|
|
58
58
|
async removeItemFromList(executionId) {
|
|
59
59
|
let response
|
|
60
60
|
await fetch(`dpr/my-reports/recently-viewed/${executionId}`, {
|
|
61
|
-
method: '
|
|
61
|
+
method: 'post',
|
|
62
62
|
headers: {
|
|
63
63
|
Accept: 'application/json',
|
|
64
64
|
'Content-Type': 'application/json',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
1
|
+
"use strict";var $=Object.create;var k=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var w=(a,n)=>{for(var o in n)k(a,o,{get:n[o],enumerable:!0})},f=(a,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of v(n))!R.call(a,e)&&e!==o&&k(a,e,{get:()=>n[e],enumerable:!(t=C(n,e))||t.enumerable});return a};var p=(a,n,o)=>(o=a!=null?$(y(a)):{},f(n||!a||!a.__esModule?k(o,"default",{value:a,enumerable:!0}):o,a)),x=a=>f(k({},"__esModule",{value:!0}),a);var V={};w(V,{BookmarkService:()=>m,default:()=>T});module.exports=x(V);var u=p(require("../../../../services/reportStoreService")),h=p(require("../../../../utils/logger"));class m extends u.default{constructor(o,t){super(o);this.isBookmarked=async(o,t,e)=>{if(!this.enabled)return!1;const r=await this.getState(e),i=this.isBookmarkedCheck(r,o,t);let s;return i&&(s=this.getBookmark(r,o,t)),s?.automatic?void 0:i};this.isBookmarkedCheck=(o,t,e)=>o.bookmarks.some(r=>r.id===t&&r.reportId===e);this.getBookmark=(o,t,e)=>o.bookmarks.find(r=>r.id===t&&r.reportId===e);this.enabled=!!t.bookmarking,this.enabled||h.default.info("Bookmarking: disabled ")}async getAllBookmarks(o){return this.enabled?(await this.getState(o)).bookmarks:[]}async addBookmark(o,t,e,r,i){if(!this.enabled)return;const s=await this.getState(o);this.isBookmarkedCheck(s,e,t)||s.bookmarks.unshift({reportId:t,id:e,type:r,automatic:i}),await this.saveState(o,s)}async removeBookmark(o,t,e){if(!this.enabled)return;const r=await this.getState(o),i=r.bookmarks.findIndex(s=>s.id===t&&s.reportId===e);i>=0&&r.bookmarks.splice(i,1),await this.saveState(o,r)}async createBookMarkToggleHtml({userConfig:o,reportId:t,id:e,csrfToken:r,ctxId:i,reportType:s,isMissing:d,nestedBaseUrl:B}){let g="Add bookmark",l=!1,b=null;if(o?.bookmarks){const c=this.getBookmark(o,e,t);c&&(b="checked",g="Remove bookmark",l=!!c.automatic)}const S=`<button class='dpr-bookmark dpr-bookmark-table' data-dpr-module='bookmark-toggle'>
|
|
2
|
+
<input class='bookmark-input' type='checkbox' id='${t}-${e}-${i}' data-report-id='${t}' data-id='${e}' data-report-type='${s}' data-csrf-token='${r}' data-base-url='${B}' ${b} />
|
|
3
3
|
<label tabindex='0' id='${e}-${t}-${i}-bookmark-label' for='${t}-${e}-${i}'><span class='dpr-bookmark-label govuk-body-s'>${g}</span></label>
|
|
4
|
-
</button
|
|
4
|
+
</button>`;return l||d?"":S}}var T=m;0&&(module.exports={BookmarkService});
|
|
5
5
|
//# sourceMappingURL=service.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/my-reports/bookmarks/service.ts"],
|
|
4
|
-
"sourcesContent": ["import ReportStoreService from '../../../../services/reportStoreService'\nimport ReportDataStore from '../../../../data/reportDataStore'\nimport { ReportType } from '../../../../types/UserReports'\nimport { ReportStoreConfig } from '../../../../types/ReportStore'\nimport logger from '../../../../utils/logger'\nimport { BookmarkStoreData } from '../../../../types/Bookmark'\nimport { ServiceFeatureConfig } from '../../../../types/DprConfig'\n\nclass BookmarkService extends ReportStoreService {\n enabled: boolean\n\n constructor(reportDataStore: ReportDataStore, serviceFeatureConfig: ServiceFeatureConfig) {\n super(reportDataStore)\n this.enabled = Boolean(serviceFeatureConfig.bookmarking)\n if (!this.enabled) logger.info(`Bookmarking: disabled `)\n }\n\n async getAllBookmarks(userId: string): Promise<BookmarkStoreData[]> {\n if (!this.enabled) return []\n\n const userConfig = await this.getState(userId)\n return userConfig.bookmarks\n }\n\n async addBookmark(\n userId: string,\n reportId: string,\n id: string,\n type: ReportType,\n automatic?: boolean,\n ): Promise<void> {\n if (!this.enabled) return\n\n const userConfig = await this.getState(userId)\n if (!this.isBookmarkedCheck(userConfig, id, reportId)) {\n userConfig.bookmarks.unshift({ reportId, id, type, automatic })\n }\n await this.saveState(userId, userConfig)\n }\n\n async removeBookmark(userId: string, id: string, reportId: string): Promise<void> {\n if (!this.enabled) return\n\n const userConfig = await this.getState(userId)\n const index = userConfig.bookmarks.findIndex((bookmark) => {\n const bmVarId = bookmark.id\n return bmVarId === id && bookmark.reportId === reportId\n })\n if (index >= 0) {\n userConfig.bookmarks.splice(index, 1)\n }\n await this.saveState(userId, userConfig)\n }\n\n isBookmarked = async (id: string, reportId: string, userId: string): Promise<boolean | undefined> => {\n if (!this.enabled) return false\n\n const userConfig = await this.getState(userId)\n const isBookmarked = this.isBookmarkedCheck(userConfig, id, reportId)\n let bookmark\n if (isBookmarked) {\n bookmark = this.getBookmark(userConfig, id, reportId)\n }\n\n return bookmark?.automatic ? undefined : isBookmarked\n }\n\n private isBookmarkedCheck = (userConfig: ReportStoreConfig, id: string, reportId: string): boolean => {\n return userConfig.bookmarks.some((bookmark) => {\n const bmVarId = bookmark.id\n return bmVarId === id && bookmark.reportId === reportId\n })\n }\n\n private getBookmark = (userConfig: ReportStoreConfig, id: string, reportId: string) => {\n return userConfig.bookmarks.find((bookmark) => {\n const bmVarId = bookmark.id\n return bmVarId === id && bookmark.reportId === reportId\n })\n }\n\n async createBookMarkToggleHtml({\n userConfig,\n reportId,\n id,\n csrfToken,\n ctxId,\n reportType,\n isMissing,\n nestedBaseUrl,\n }: {\n userConfig: ReportStoreConfig\n reportId: string\n id: string\n csrfToken: string\n ctxId: string\n reportType: ReportType\n isMissing: boolean\n nestedBaseUrl: string | undefined\n }) {\n let tooltip = 'Add bookmark'\n let automatic = false\n let checked = null\n\n if (userConfig?.bookmarks) {\n const bookmark = this.getBookmark(userConfig, id, reportId)\n if (bookmark) {\n checked = 'checked'\n tooltip = 'Remove bookmark'\n automatic = Boolean(bookmark.automatic)\n }\n }\n\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA+B,sDAI/BC,EAAmB,uCAInB,MAAMJ,UAAwB,EAAAK,OAAmB,CAG/C,YAAYC,EAAkCC,EAA4C,CACxF,MAAMD,CAAe,EA0CvB,kBAAe,MAAOE,EAAYC,EAAkBC,IAAiD,CACnG,GAAI,CAAC,KAAK,QAAS,MAAO,GAE1B,MAAMC,EAAa,M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SAAAF,EACA,GAAAD,EACA,UAAAU,EACA,MAAAC,EACA,WAAAC,EACA,UAAAC,EACA,cAAAC,CACF,EASG,CACD,IAAIC,EAAU,eACVP,EAAY,GACZQ,EAAU,KAEd,GAAIb,GAAY,UAAW,CACzB,MAAME,EAAW,KAAK,YAAYF,EAAYH,EAAIC,CAAQ,EACtDI,IACFW,EAAU,UACVD,EAAU,kBACVP,EAAY,EAAQH,EAAS,UAEjC,CAEA,
|
|
6
|
-
"names": ["service_exports", "__export", "BookmarkService", "service_default", "__toCommonJS", "import_reportStoreService", "import_logger", "ReportStoreService", "reportDataStore", "serviceFeatureConfig", "id", "reportId", "userId", "userConfig", "isBookmarked", "bookmark", "logger", "type", "automatic", "index", "csrfToken", "ctxId", "reportType", "isMissing", "nestedBaseUrl", "tooltip", "checked"]
|
|
4
|
+
"sourcesContent": ["import ReportStoreService from '../../../../services/reportStoreService'\nimport ReportDataStore from '../../../../data/reportDataStore'\nimport { ReportType } from '../../../../types/UserReports'\nimport { ReportStoreConfig } from '../../../../types/ReportStore'\nimport logger from '../../../../utils/logger'\nimport { BookmarkStoreData } from '../../../../types/Bookmark'\nimport { ServiceFeatureConfig } from '../../../../types/DprConfig'\n\nclass BookmarkService extends ReportStoreService {\n enabled: boolean\n\n constructor(reportDataStore: ReportDataStore, serviceFeatureConfig: ServiceFeatureConfig) {\n super(reportDataStore)\n this.enabled = Boolean(serviceFeatureConfig.bookmarking)\n if (!this.enabled) logger.info(`Bookmarking: disabled `)\n }\n\n async getAllBookmarks(userId: string): Promise<BookmarkStoreData[]> {\n if (!this.enabled) return []\n\n const userConfig = await this.getState(userId)\n return userConfig.bookmarks\n }\n\n async addBookmark(\n userId: string,\n reportId: string,\n id: string,\n type: ReportType,\n automatic?: boolean,\n ): Promise<void> {\n if (!this.enabled) return\n\n const userConfig = await this.getState(userId)\n if (!this.isBookmarkedCheck(userConfig, id, reportId)) {\n userConfig.bookmarks.unshift({ reportId, id, type, automatic })\n }\n await this.saveState(userId, userConfig)\n }\n\n async removeBookmark(userId: string, id: string, reportId: string): Promise<void> {\n if (!this.enabled) return\n\n const userConfig = await this.getState(userId)\n const index = userConfig.bookmarks.findIndex((bookmark) => {\n const bmVarId = bookmark.id\n return bmVarId === id && bookmark.reportId === reportId\n })\n if (index >= 0) {\n userConfig.bookmarks.splice(index, 1)\n }\n await this.saveState(userId, userConfig)\n }\n\n isBookmarked = async (id: string, reportId: string, userId: string): Promise<boolean | undefined> => {\n if (!this.enabled) return false\n\n const userConfig = await this.getState(userId)\n const isBookmarked = this.isBookmarkedCheck(userConfig, id, reportId)\n let bookmark\n if (isBookmarked) {\n bookmark = this.getBookmark(userConfig, id, reportId)\n }\n\n return bookmark?.automatic ? undefined : isBookmarked\n }\n\n private isBookmarkedCheck = (userConfig: ReportStoreConfig, id: string, reportId: string): boolean => {\n return userConfig.bookmarks.some((bookmark) => {\n const bmVarId = bookmark.id\n return bmVarId === id && bookmark.reportId === reportId\n })\n }\n\n private getBookmark = (userConfig: ReportStoreConfig, id: string, reportId: string) => {\n return userConfig.bookmarks.find((bookmark) => {\n const bmVarId = bookmark.id\n return bmVarId === id && bookmark.reportId === reportId\n })\n }\n\n async createBookMarkToggleHtml({\n userConfig,\n reportId,\n id,\n csrfToken,\n ctxId,\n reportType,\n isMissing,\n nestedBaseUrl,\n }: {\n userConfig: ReportStoreConfig\n reportId: string\n id: string\n csrfToken: string\n ctxId: string\n reportType: ReportType\n isMissing: boolean\n nestedBaseUrl: string | undefined\n }) {\n let tooltip = 'Add bookmark'\n let automatic = false\n let checked = null\n\n if (userConfig?.bookmarks) {\n const bookmark = this.getBookmark(userConfig, id, reportId)\n if (bookmark) {\n checked = 'checked'\n tooltip = 'Remove bookmark'\n automatic = Boolean(bookmark.automatic)\n }\n }\n\n const bookmarkButton = `<button class='dpr-bookmark dpr-bookmark-table' data-dpr-module='bookmark-toggle'>\n <input class='bookmark-input' type='checkbox' id='${reportId}-${id}-${ctxId}' data-report-id='${reportId}' data-id='${id}' data-report-type='${reportType}' data-csrf-token='${csrfToken}' data-base-url='${nestedBaseUrl}' ${checked} />\n <label tabindex='0' id='${id}-${reportId}-${ctxId}-bookmark-label' for='${reportId}-${id}-${ctxId}'><span class='dpr-bookmark-label govuk-body-s'>${tooltip}</span></label>\n</button>`\n\n return automatic || isMissing ? '' : bookmarkButton\n }\n}\n\nexport { BookmarkService }\nexport default BookmarkService\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA+B,sDAI/BC,EAAmB,uCAInB,MAAMJ,UAAwB,EAAAK,OAAmB,CAG/C,YAAYC,EAAkCC,EAA4C,CACxF,MAAMD,CAAe,EA0CvB,kBAAe,MAAOE,EAAYC,EAAkBC,IAAiD,CACnG,GAAI,CAAC,KAAK,QAAS,MAAO,GAE1B,MAAMC,EAAa,MAAM,KAAK,SAASD,CAAM,EACvCE,EAAe,KAAK,kBAAkBD,EAAYH,EAAIC,CAAQ,EACpE,IAAII,EACJ,OAAID,IACFC,EAAW,KAAK,YAAYF,EAAYH,EAAIC,CAAQ,GAG/CI,GAAU,UAAY,OAAYD,CAC3C,EAEA,KAAQ,kBAAoB,CAACD,EAA+BH,EAAYC,IAC/DE,EAAW,UAAU,KAAME,GAChBA,EAAS,KACNL,GAAMK,EAAS,WAAaJ,CAChD,EAGH,KAAQ,YAAc,CAACE,EAA+BH,EAAYC,IACzDE,EAAW,UAAU,KAAME,GAChBA,EAAS,KACNL,GAAMK,EAAS,WAAaJ,CAChD,EAjED,KAAK,QAAU,EAAQF,EAAqB,YACvC,KAAK,SAAS,EAAAO,QAAO,KAAK,wBAAwB,CACzD,CAEA,MAAM,gBAAgBJ,EAA8C,CAClE,OAAK,KAAK,SAES,MAAM,KAAK,SAASA,CAAM,GAC3B,UAHQ,CAAC,CAI7B,CAEA,MAAM,YACJA,EACAD,EACAD,EACAO,EACAC,EACe,CACf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"BookmarkService", "service_default", "__toCommonJS", "import_reportStoreService", "import_logger", "ReportStoreService", "reportDataStore", "serviceFeatureConfig", "id", "reportId", "userId", "userConfig", "isBookmarked", "bookmark", "logger", "type", "automatic", "index", "csrfToken", "ctxId", "reportType", "isMissing", "nestedBaseUrl", "tooltip", "checked", "bookmarkButton"]
|
|
7
7
|
}
|
|
@@ -111,12 +111,12 @@ class BookmarkService extends ReportStoreService {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
: `<button class='dpr-bookmark dpr-bookmark-table' data-dpr-module='bookmark-toggle'>
|
|
117
|
-
<input class='bookmark-input' type='checkbox' id='${reportId}-${id}-${ctxId}' data-report-id='${reportId}' data-id='${id}' data-report-type='${reportType}' data-csrf-token='${csrfToken}' data-base-url="${nestedBaseUrl}" ${checked} />
|
|
114
|
+
const bookmarkButton = `<button class='dpr-bookmark dpr-bookmark-table' data-dpr-module='bookmark-toggle'>
|
|
115
|
+
<input class='bookmark-input' type='checkbox' id='${reportId}-${id}-${ctxId}' data-report-id='${reportId}' data-id='${id}' data-report-type='${reportType}' data-csrf-token='${csrfToken}' data-base-url='${nestedBaseUrl}' ${checked} />
|
|
118
116
|
<label tabindex='0' id='${id}-${reportId}-${ctxId}-bookmark-label' for='${reportId}-${id}-${ctxId}'><span class='dpr-bookmark-label govuk-body-s'>${tooltip}</span></label>
|
|
119
117
|
</button>`
|
|
118
|
+
|
|
119
|
+
return automatic || isMissing ? '' : bookmarkButton
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.create;var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var s in r)o(e,s,{get:r[s],enumerable:!0})},a=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of v(r))!m.call(e,t)&&t!==s&&o(e,t,{get:()=>r[t],enumerable:!(i=l(r,t))||i.enumerable});return e};var u=(e,r,s)=>(s=e!=null?d(n(e)):{},a(r||!e||!e.__esModule?o(s,"default",{value:e,enumerable:!0}):s,e)),S=e=>a(o({},"__esModule",{value:!0}),e);var w={};R(w,{RecentlyViewedReportsController:()=>c,default:()=>f});module.exports=S(w);var p=u(require("../../../../utils/localsHelper"));class c{constructor(r){this.
|
|
1
|
+
"use strict";var d=Object.create;var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var s in r)o(e,s,{get:r[s],enumerable:!0})},a=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of v(r))!m.call(e,t)&&t!==s&&o(e,t,{get:()=>r[t],enumerable:!(i=l(r,t))||i.enumerable});return e};var u=(e,r,s)=>(s=e!=null?d(n(e)):{},a(r||!e||!e.__esModule?o(s,"default",{value:e,enumerable:!0}):s,e)),S=e=>a(o({},"__esModule",{value:!0}),e);var w={};R(w,{RecentlyViewedReportsController:()=>c,default:()=>f});module.exports=S(w);var p=u(require("../../../../utils/localsHelper"));class c{constructor(r){this.POST=async(r,s)=>{const{dprUser:i}=p.default.getValues(s),{id:t}=r.params;await this.services.recentlyViewedService.removeReport(t,i.id),await this.services.requestedReportService.removeReport(t,i.id),s.end()};this.services=r}}var f=c;0&&(module.exports={RecentlyViewedReportsController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/my-reports/recently-viewed/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport LocalsHelper from '../../../../utils/localsHelper'\n\nclass RecentlyViewedReportsController {\n services: Services\n\n constructor(services: Services) {\n this.services = services\n }\n\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyB,6CAEzB,MAAMH,CAAgC,CAGpC,YAAYI,EAAoB,CAIhC,
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport LocalsHelper from '../../../../utils/localsHelper'\n\nclass RecentlyViewedReportsController {\n services: Services\n\n constructor(services: Services) {\n this.services = services\n }\n\n POST: RequestHandler = async (req, res) => {\n const { dprUser } = LocalsHelper.getValues(res)\n const { id } = req.params\n await this.services.recentlyViewedService.removeReport(id, dprUser.id)\n await this.services.requestedReportService.removeReport(id, dprUser.id)\n res.end()\n }\n}\n\nexport { RecentlyViewedReportsController }\nexport default RecentlyViewedReportsController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyB,6CAEzB,MAAMH,CAAgC,CAGpC,YAAYI,EAAoB,CAIhC,UAAuB,MAAOC,EAAKC,IAAQ,CACzC,KAAM,CAAE,QAAAC,CAAQ,EAAI,EAAAC,QAAa,UAAUF,CAAG,EACxC,CAAE,GAAAG,CAAG,EAAIJ,EAAI,OACnB,MAAM,KAAK,SAAS,sBAAsB,aAAaI,EAAIF,EAAQ,EAAE,EACrE,MAAM,KAAK,SAAS,uBAAuB,aAAaE,EAAIF,EAAQ,EAAE,EACtED,EAAI,IAAI,CACV,EATE,KAAK,SAAWF,CAClB,CASF,CAGA,IAAOH,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "RecentlyViewedReportsController", "controller_default", "__toCommonJS", "import_localsHelper", "services", "req", "res", "dprUser", "LocalsHelper", "id"]
|
|
7
7
|
}
|
|
@@ -9,7 +9,7 @@ class RecentlyViewedReportsController {
|
|
|
9
9
|
this.services = services
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
POST: RequestHandler = async (req, res) => {
|
|
13
13
|
const { dprUser } = LocalsHelper.getValues(res)
|
|
14
14
|
const { id } = req.params
|
|
15
15
|
await this.services.recentlyViewedService.removeReport(id, dprUser.id)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var f=Object.create;var
|
|
1
|
+
"use strict";var f=Object.create;var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var S=(r,t)=>{for(var e in t)i(r,e,{get:t[e],enumerable:!0})},m=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R(t))!P.call(r,o)&&o!==e&&i(r,o,{get:()=>t[o],enumerable:!(s=a(t,o))||s.enumerable});return r};var n=(r,t,e)=>(e=r!=null?f(d(r)):{},m(t||!r||!r.__esModule?i(e,"default",{value:r,enumerable:!0}):e,r)),g=r=>m(i({},"__esModule",{value:!0}),r);var w={};S(w,{default:()=>v,routes:()=>c});module.exports=g(w);var u=require("express"),l=n(require("./controller")),p=n(require("./list/routes"));function c({layoutPath:r,services:t}){const e=(0,u.Router)({mergeParams:!0}),s=new l.default(t);return e.post("/:id",s.POST),e.use("/list",(0,p.default)({layoutPath:r,services:t})),e}var v=c;0&&(module.exports={routes});
|
|
2
2
|
//# sourceMappingURL=routes.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/my-reports/recently-viewed/routes.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-param-reassign */\nimport { Router } from 'express'\nimport { Services } from '../../../../types/Services'\nimport RecentlyViewedReportsController from './controller'\nimport listRoutes from './list/routes'\n\nexport function routes({ layoutPath, services }: { layoutPath: string; services: Services }) {\n const router = Router({ mergeParams: true })\n\n const controller = new RecentlyViewedReportsController(services)\n router.
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,WAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAuB,mBAEvBC,EAA4C,2BAC5CC,EAAuB,4BAEhB,SAASJ,EAAO,CAAE,WAAAK,EAAY,SAAAC,CAAS,EAA+C,CAC3F,MAAMC,KAAS,UAAO,CAAE,YAAa,EAAK,CAAC,EAErCC,EAAa,IAAI,EAAAC,QAAgCH,CAAQ,EAC/D,OAAAC,EAAO,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-param-reassign */\nimport { Router } from 'express'\nimport { Services } from '../../../../types/Services'\nimport RecentlyViewedReportsController from './controller'\nimport listRoutes from './list/routes'\n\nexport function routes({ layoutPath, services }: { layoutPath: string; services: Services }) {\n const router = Router({ mergeParams: true })\n\n const controller = new RecentlyViewedReportsController(services)\n router.post('/:id', controller.POST)\n router.use(`/list`, listRoutes({ layoutPath, services }))\n\n return router\n}\n\nexport default routes\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,WAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAuB,mBAEvBC,EAA4C,2BAC5CC,EAAuB,4BAEhB,SAASJ,EAAO,CAAE,WAAAK,EAAY,SAAAC,CAAS,EAA+C,CAC3F,MAAMC,KAAS,UAAO,CAAE,YAAa,EAAK,CAAC,EAErCC,EAAa,IAAI,EAAAC,QAAgCH,CAAQ,EAC/D,OAAAC,EAAO,KAAK,OAAQC,EAAW,IAAI,EACnCD,EAAO,IAAI,WAAS,EAAAG,SAAW,CAAE,WAAAL,EAAY,SAAAC,CAAS,CAAC,CAAC,EAEjDC,CACT,CAEA,IAAOR,EAAQC",
|
|
6
6
|
"names": ["routes_exports", "__export", "routes_default", "routes", "__toCommonJS", "import_express", "import_controller", "import_routes", "layoutPath", "services", "router", "controller", "RecentlyViewedReportsController", "listRoutes"]
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ export function routes({ layoutPath, services }: { layoutPath: string; services:
|
|
|
8
8
|
const router = Router({ mergeParams: true })
|
|
9
9
|
|
|
10
10
|
const controller = new RecentlyViewedReportsController(services)
|
|
11
|
-
router.
|
|
11
|
+
router.post('/:id', controller.POST)
|
|
12
12
|
router.use(`/list`, listRoutes({ layoutPath, services }))
|
|
13
13
|
|
|
14
14
|
return router
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.create;var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var s in r)i(e,s,{get:r[s],enumerable:!0})},a=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of m(r))!v.call(e,t)&&t!==s&&i(e,t,{get:()=>r[t],enumerable:!(o=l(r,t))||o.enumerable});return e};var R=(e,r,s)=>(s=e!=null?d(n(e)):{},a(r||!e||!e.__esModule?i(s,"default",{value:e,enumerable:!0}):s,e)),
|
|
1
|
+
"use strict";var d=Object.create;var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var s in r)i(e,s,{get:r[s],enumerable:!0})},a=(e,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of m(r))!v.call(e,t)&&t!==s&&i(e,t,{get:()=>r[t],enumerable:!(o=l(r,t))||o.enumerable});return e};var R=(e,r,s)=>(s=e!=null?d(n(e)):{},a(r||!e||!e.__esModule?i(s,"default",{value:e,enumerable:!0}):s,e)),S=e=>a(i({},"__esModule",{value:!0}),e);var q={};u(q,{RequestedReportsController:()=>c,default:()=>f});module.exports=S(q);var p=R(require("../../../../utils/localsHelper"));class c{constructor(r){this.POST=async(r,s)=>{const{dprUser:o}=p.default.getValues(s),{id:t}=r.params;await this.services.requestedReportService.removeReport(t,o.id),s.end()};this.services=r}}var f=c;0&&(module.exports={RequestedReportsController});
|
|
2
2
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/my-reports/requested-reports/controller.ts"],
|
|
4
|
-
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport LocalsHelper from '../../../../utils/localsHelper'\n\nclass RequestedReportsController {\n services: Services\n\n constructor(services: Services) {\n this.services = services\n }\n\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyB,6CAEzB,MAAMH,CAA2B,CAG/B,YAAYI,EAAoB,CAIhC,
|
|
4
|
+
"sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../types/Services'\nimport LocalsHelper from '../../../../utils/localsHelper'\n\nclass RequestedReportsController {\n services: Services\n\n constructor(services: Services) {\n this.services = services\n }\n\n POST: RequestHandler = async (req, res) => {\n const { dprUser } = LocalsHelper.getValues(res)\n const { id } = req.params\n await this.services.requestedReportService.removeReport(id, dprUser.id)\n res.end()\n }\n}\n\nexport { RequestedReportsController }\nexport default RequestedReportsController\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyB,6CAEzB,MAAMH,CAA2B,CAG/B,YAAYI,EAAoB,CAIhC,UAAuB,MAAOC,EAAKC,IAAQ,CACzC,KAAM,CAAE,QAAAC,CAAQ,EAAI,EAAAC,QAAa,UAAUF,CAAG,EACxC,CAAE,GAAAG,CAAG,EAAIJ,EAAI,OACnB,MAAM,KAAK,SAAS,uBAAuB,aAAaI,EAAIF,EAAQ,EAAE,EACtED,EAAI,IAAI,CACV,EARE,KAAK,SAAWF,CAClB,CAQF,CAGA,IAAOH,EAAQD",
|
|
6
6
|
"names": ["controller_exports", "__export", "RequestedReportsController", "controller_default", "__toCommonJS", "import_localsHelper", "services", "req", "res", "dprUser", "LocalsHelper", "id"]
|
|
7
7
|
}
|
|
@@ -9,7 +9,7 @@ class RequestedReportsController {
|
|
|
9
9
|
this.services = services
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
POST: RequestHandler = async (req, res) => {
|
|
13
13
|
const { dprUser } = LocalsHelper.getValues(res)
|
|
14
14
|
const { id } = req.params
|
|
15
15
|
await this.services.requestedReportService.removeReport(id, dprUser.id)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var f=Object.create;var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var f=Object.create;var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var S=(r,t)=>{for(var o in t)i(r,o,{get:t[o],enumerable:!0})},u=(r,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of R(t))!P.call(r,e)&&e!==o&&i(r,e,{get:()=>t[e],enumerable:!(s=a(t,e))||s.enumerable});return r};var m=(r,t,o)=>(o=r!=null?f(d(r)):{},u(t||!r||!r.__esModule?i(o,"default",{value:r,enumerable:!0}):o,r)),g=r=>u(i({},"__esModule",{value:!0}),r);var x={};S(x,{default:()=>v,routes:()=>c});module.exports=g(x);var n=require("express"),l=m(require("./controller")),p=m(require("./list/routes"));function c({layoutPath:r,services:t}){const o=(0,n.Router)({mergeParams:!0}),s=new l.default(t);return o.post("/:id",s.POST),o.use("/list",(0,p.default)({layoutPath:r,services:t})),o}var v=c;0&&(module.exports={routes});
|
|
2
2
|
//# sourceMappingURL=routes.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/my-reports/requested-reports/routes.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-param-reassign */\nimport { Router } from 'express'\nimport { Services } from '../../../../types/Services'\nimport RequestedReportsController from './controller'\nimport listRoutes from './list/routes'\n\nexport function routes({ layoutPath, services }: { layoutPath: string; services: Services }) {\n const router = Router({ mergeParams: true })\n\n const controller = new RequestedReportsController(services)\n router.
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,WAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAuB,mBAEvBC,EAAuC,2BACvCC,EAAuB,4BAEhB,SAASJ,EAAO,CAAE,WAAAK,EAAY,SAAAC,CAAS,EAA+C,CAC3F,MAAMC,KAAS,UAAO,CAAE,YAAa,EAAK,CAAC,EAErCC,EAAa,IAAI,EAAAC,QAA2BH,CAAQ,EAC1D,OAAAC,EAAO,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-param-reassign */\nimport { Router } from 'express'\nimport { Services } from '../../../../types/Services'\nimport RequestedReportsController from './controller'\nimport listRoutes from './list/routes'\n\nexport function routes({ layoutPath, services }: { layoutPath: string; services: Services }) {\n const router = Router({ mergeParams: true })\n\n const controller = new RequestedReportsController(services)\n router.post('/:id', controller.POST)\n\n router.use(`/list`, listRoutes({ layoutPath, services }))\n return router\n}\n\nexport default routes\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,WAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAuB,mBAEvBC,EAAuC,2BACvCC,EAAuB,4BAEhB,SAASJ,EAAO,CAAE,WAAAK,EAAY,SAAAC,CAAS,EAA+C,CAC3F,MAAMC,KAAS,UAAO,CAAE,YAAa,EAAK,CAAC,EAErCC,EAAa,IAAI,EAAAC,QAA2BH,CAAQ,EAC1D,OAAAC,EAAO,KAAK,OAAQC,EAAW,IAAI,EAEnCD,EAAO,IAAI,WAAS,EAAAG,SAAW,CAAE,WAAAL,EAAY,SAAAC,CAAS,CAAC,CAAC,EACjDC,CACT,CAEA,IAAOR,EAAQC",
|
|
6
6
|
"names": ["routes_exports", "__export", "routes_default", "routes", "__toCommonJS", "import_express", "import_controller", "import_routes", "layoutPath", "services", "router", "controller", "RequestedReportsController", "listRoutes"]
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ export function routes({ layoutPath, services }: { layoutPath: string; services:
|
|
|
8
8
|
const router = Router({ mergeParams: true })
|
|
9
9
|
|
|
10
10
|
const controller = new RequestedReportsController(services)
|
|
11
|
-
router.
|
|
11
|
+
router.post('/:id', controller.POST)
|
|
12
12
|
|
|
13
13
|
router.use(`/list`, listRoutes({ layoutPath, services }))
|
|
14
14
|
return router
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/hmpps-digital-prison-reporting-frontend",
|
|
3
3
|
"description": "The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.",
|
|
4
|
-
"version": "4.22.
|
|
4
|
+
"version": "4.22.4",
|
|
5
5
|
"main": "dpr/all.mjs",
|
|
6
6
|
"sass": "dpr/all.scss",
|
|
7
7
|
"engines": {
|