@hed-hog/core 0.0.298 → 0.0.300
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/dist/dashboard/dashboard/dashboard.controller.d.ts +9 -0
- package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.d.ts +9 -0
- package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +14 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js +28 -3
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +22 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +185 -35
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +1 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js +5 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +1 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.js +5 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +72 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +111 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +76 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +614 -23
- package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +3 -0
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +3 -0
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts +2 -0
- package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts +2 -0
- package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts.map +1 -1
- package/hedhog/data/dashboard.yaml +12 -6
- package/hedhog/data/dashboard_component_role.yaml +66 -0
- package/hedhog/data/dashboard_item.yaml +1 -1
- package/hedhog/data/dashboard_role.yaml +2 -8
- package/hedhog/data/route.yaml +84 -0
- package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +457 -135
- package/hedhog/frontend/app/dashboard/[slug]/types.ts.ejs +3 -0
- package/hedhog/frontend/app/dashboard/[slug]/widget-renderer.tsx.ejs +365 -28
- package/hedhog/frontend/app/dashboard/components/add-widget-selector-dialog.tsx.ejs +376 -247
- package/hedhog/frontend/app/dashboard/components/draggable-grid.tsx.ejs +64 -18
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +1389 -0
- package/hedhog/frontend/app/dashboard/dashboard.css.ejs +37 -0
- package/hedhog/frontend/app/dashboard/management/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +6 -6
- package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +8 -8
- package/hedhog/frontend/app/dashboard/management/tabs/items-tab.tsx.ejs +3 -3
- package/hedhog/frontend/app/dashboard/page.tsx.ejs +3 -25
- package/hedhog/frontend/messages/en.json +115 -2
- package/hedhog/frontend/messages/pt.json +114 -1
- package/hedhog/frontend/public/dashboard-previews/.gitkeep +12 -0
- package/hedhog/frontend/public/dashboard-previews/account-security.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/active-users-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/activity-timeline.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/cash-balance-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/cash-flow-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/default-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/email-notifications.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/financial-alerts.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/login-history-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/mail-sent-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/mail-sent-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/menus-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/payable-30d-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/permissions-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/permissions-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/profile-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/receivable-30d-kpi.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/routes-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/session-activity-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/sessions-today-card.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-access-level.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-actions-today.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-consecutive-days.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/stat-online-time.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/upcoming-payable.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/upcoming-receivable.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/user-growth-chart.png +0 -0
- package/hedhog/frontend/public/dashboard-previews/user-roles.png +0 -0
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/account-security.tsx.ejs +34 -30
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/active-users-card.tsx.ejs +2 -2
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/activity-timeline.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/email-notifications.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/locale-config.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/login-history-chart.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/mail-config.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/mail-sent-card.tsx.ejs +2 -2
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/mail-sent-chart.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/menus-card.tsx.ejs +2 -2
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/oauth-config.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/permissions-card.tsx.ejs +2 -2
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/permissions-chart.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/profile-card.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/routes-card.tsx.ejs +2 -2
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/session-activity-chart.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/sessions-today-card.tsx.ejs +2 -2
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-access-level.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-actions-today.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-consecutive-days.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-online-time.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/storage-config.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/theme-config.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-growth-chart.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-roles.tsx.ejs +1 -1
- package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-sessions.tsx.ejs +2 -2
- package/hedhog/table/dashboard.yaml +6 -0
- package/hedhog/table/dashboard_component.yaml +7 -0
- package/package.json +5 -5
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +51 -14
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +254 -43
- package/src/dashboard/dashboard-component/dto/create.dto.ts +4 -0
- package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -0
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +112 -1
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +782 -24
|
@@ -40,6 +40,7 @@ export declare class DashboardController {
|
|
|
40
40
|
created_at: Date;
|
|
41
41
|
updated_at: Date;
|
|
42
42
|
slug: string;
|
|
43
|
+
library_slug: string;
|
|
43
44
|
min_width: number;
|
|
44
45
|
max_width: number | null;
|
|
45
46
|
min_height: number;
|
|
@@ -115,6 +116,8 @@ export declare class DashboardController {
|
|
|
115
116
|
created_at: Date;
|
|
116
117
|
updated_at: Date;
|
|
117
118
|
slug: string;
|
|
119
|
+
icon: string | null;
|
|
120
|
+
is_template: boolean;
|
|
118
121
|
}>;
|
|
119
122
|
createDashboard(data: CreateDashboardDTO, locale: string): Promise<{
|
|
120
123
|
dashboard_item: ({
|
|
@@ -144,6 +147,7 @@ export declare class DashboardController {
|
|
|
144
147
|
created_at: Date;
|
|
145
148
|
updated_at: Date;
|
|
146
149
|
slug: string;
|
|
150
|
+
library_slug: string;
|
|
147
151
|
min_width: number;
|
|
148
152
|
max_width: number | null;
|
|
149
153
|
min_height: number;
|
|
@@ -219,6 +223,8 @@ export declare class DashboardController {
|
|
|
219
223
|
created_at: Date;
|
|
220
224
|
updated_at: Date;
|
|
221
225
|
slug: string;
|
|
226
|
+
icon: string | null;
|
|
227
|
+
is_template: boolean;
|
|
222
228
|
}>;
|
|
223
229
|
updateDashboard(id: number, data: UpdateDashboardDTO, locale: string): Promise<{
|
|
224
230
|
dashboard_item: ({
|
|
@@ -248,6 +254,7 @@ export declare class DashboardController {
|
|
|
248
254
|
created_at: Date;
|
|
249
255
|
updated_at: Date;
|
|
250
256
|
slug: string;
|
|
257
|
+
library_slug: string;
|
|
251
258
|
min_width: number;
|
|
252
259
|
max_width: number | null;
|
|
253
260
|
min_height: number;
|
|
@@ -323,6 +330,8 @@ export declare class DashboardController {
|
|
|
323
330
|
created_at: Date;
|
|
324
331
|
updated_at: Date;
|
|
325
332
|
slug: string;
|
|
333
|
+
icon: string | null;
|
|
334
|
+
is_template: boolean;
|
|
326
335
|
}>;
|
|
327
336
|
deleteDashboard(id: number, locale: string): Promise<{
|
|
328
337
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.controller.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard/dashboard.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,OAAO,CAAC;AACf,qBA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+42,7 @@ export declare class DashboardService {
|
|
|
42
42
|
created_at: Date;
|
|
43
43
|
updated_at: Date;
|
|
44
44
|
slug: string;
|
|
45
|
+
library_slug: string;
|
|
45
46
|
min_width: number;
|
|
46
47
|
max_width: number | null;
|
|
47
48
|
min_height: number;
|
|
@@ -117,6 +118,8 @@ export declare class DashboardService {
|
|
|
117
118
|
created_at: Date;
|
|
118
119
|
updated_at: Date;
|
|
119
120
|
slug: string;
|
|
121
|
+
icon: string | null;
|
|
122
|
+
is_template: boolean;
|
|
120
123
|
}>;
|
|
121
124
|
createDashboard(data: CreateDashboardDTO, locale: string): Promise<{
|
|
122
125
|
dashboard_item: ({
|
|
@@ -146,6 +149,7 @@ export declare class DashboardService {
|
|
|
146
149
|
created_at: Date;
|
|
147
150
|
updated_at: Date;
|
|
148
151
|
slug: string;
|
|
152
|
+
library_slug: string;
|
|
149
153
|
min_width: number;
|
|
150
154
|
max_width: number | null;
|
|
151
155
|
min_height: number;
|
|
@@ -221,6 +225,8 @@ export declare class DashboardService {
|
|
|
221
225
|
created_at: Date;
|
|
222
226
|
updated_at: Date;
|
|
223
227
|
slug: string;
|
|
228
|
+
icon: string | null;
|
|
229
|
+
is_template: boolean;
|
|
224
230
|
}>;
|
|
225
231
|
updateDashboard(id: number, data: UpdateDashboardDTO, locale: string): Promise<{
|
|
226
232
|
dashboard_item: ({
|
|
@@ -250,6 +256,7 @@ export declare class DashboardService {
|
|
|
250
256
|
created_at: Date;
|
|
251
257
|
updated_at: Date;
|
|
252
258
|
slug: string;
|
|
259
|
+
library_slug: string;
|
|
253
260
|
min_width: number;
|
|
254
261
|
max_width: number | null;
|
|
255
262
|
min_height: number;
|
|
@@ -325,6 +332,8 @@ export declare class DashboardService {
|
|
|
325
332
|
created_at: Date;
|
|
326
333
|
updated_at: Date;
|
|
327
334
|
slug: string;
|
|
335
|
+
icon: string | null;
|
|
336
|
+
is_template: boolean;
|
|
328
337
|
}>;
|
|
329
338
|
deleteDashboard(id: number, locale: string): Promise<{
|
|
330
339
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard/dashboard.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE/D,qBACa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAEjD,gBAAgB,CAAC,gBAAgB,KAAA;;;;;;;;;IAuDjC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"dashboard.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard/dashboard.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE/D,qBACa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAEjD,gBAAgB,CAAC,gBAAgB,KAAA;;;;;;;;;IAuDjC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+CvC,eAAe,CAAC,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BxD,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCpE,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;CAgBjD"}
|
|
@@ -14,7 +14,8 @@ export declare class DashboardComponentController {
|
|
|
14
14
|
}>;
|
|
15
15
|
getAllComponentsByUserRole(paginationParams: any, { id }: {
|
|
16
16
|
id: any;
|
|
17
|
-
}): Promise<{
|
|
17
|
+
}, librarySlug?: string, exclude?: string): Promise<{
|
|
18
|
+
modules: string[];
|
|
18
19
|
total: any;
|
|
19
20
|
lastPage: number;
|
|
20
21
|
page: number;
|
|
@@ -51,6 +52,7 @@ export declare class DashboardComponentController {
|
|
|
51
52
|
created_at: Date;
|
|
52
53
|
updated_at: Date;
|
|
53
54
|
slug: string;
|
|
55
|
+
library_slug: string;
|
|
54
56
|
min_width: number;
|
|
55
57
|
max_width: number | null;
|
|
56
58
|
min_height: number;
|
|
@@ -84,6 +86,7 @@ export declare class DashboardComponentController {
|
|
|
84
86
|
created_at: Date;
|
|
85
87
|
updated_at: Date;
|
|
86
88
|
slug: string;
|
|
89
|
+
library_slug: string;
|
|
87
90
|
min_width: number;
|
|
88
91
|
max_width: number | null;
|
|
89
92
|
min_height: number;
|
|
@@ -117,6 +120,7 @@ export declare class DashboardComponentController {
|
|
|
117
120
|
created_at: Date;
|
|
118
121
|
updated_at: Date;
|
|
119
122
|
slug: string;
|
|
123
|
+
library_slug: string;
|
|
120
124
|
min_width: number;
|
|
121
125
|
max_width: number | null;
|
|
122
126
|
min_height: number;
|
|
@@ -130,6 +134,7 @@ export declare class DashboardComponentController {
|
|
|
130
134
|
created_at: Date;
|
|
131
135
|
updated_at: Date;
|
|
132
136
|
slug: string;
|
|
137
|
+
library_slug: string;
|
|
133
138
|
min_width: number;
|
|
134
139
|
max_width: number | null;
|
|
135
140
|
min_height: number;
|
|
@@ -137,5 +142,13 @@ export declare class DashboardComponentController {
|
|
|
137
142
|
height: number;
|
|
138
143
|
is_resizable: boolean;
|
|
139
144
|
}>;
|
|
145
|
+
savePreview(id: number, file: MulterFile, locale: string): Promise<{
|
|
146
|
+
success: boolean;
|
|
147
|
+
componentId: number;
|
|
148
|
+
slug: string;
|
|
149
|
+
library_slug: string;
|
|
150
|
+
fileName: string;
|
|
151
|
+
relativeUrl: string;
|
|
152
|
+
}>;
|
|
140
153
|
}
|
|
141
154
|
//# sourceMappingURL=dashboard-component.controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-component.controller.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dashboard-component.controller.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.controller.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACH,2BAA2B,EAC3B,2BAA2B,EAC9B,MAAM,OAAO,CAAC;AAEf,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIvE,gBAAgB,CAAe,gBAAgB,KAAA;;;;;;;;;IAK/C,0BAA0B,CACV,gBAAgB,KAAA,EACtB,EAAE,EAAE,EAAE;;KAAA,EACQ,WAAW,CAAC,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,MAAM;;;;;;;;;;IAapC,YAAY,CACiB,EAAE,EAAE,MAAM,EAC3B,MAAM,EAAE,MAAM,EAChB,EAAE,EAAE,EAAE,MAAM,EAAE;;KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMxB,eAAe,CAAS,IAAI,EAAE,2BAA2B,EAAY,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKnF,eAAe,CACc,EAAE,EAAE,MAAM,EAC7B,IAAI,EAAE,2BAA2B,EAC/B,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAM1B,eAAe,CAA4B,EAAE,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM;;;;;;;;;;;;;;IAgB/E,WAAW,CACkB,EAAE,EAAE,MAAM,EACrB,IAAI,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM;;;;;;;;CAI3B"}
|
|
@@ -17,6 +17,7 @@ const api_1 = require("@hed-hog/api");
|
|
|
17
17
|
const api_locale_1 = require("@hed-hog/api-locale");
|
|
18
18
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
19
19
|
const common_1 = require("@nestjs/common");
|
|
20
|
+
const platform_express_1 = require("@nestjs/platform-express");
|
|
20
21
|
const dashboard_component_service_1 = require("./dashboard-component.service");
|
|
21
22
|
const dto_1 = require("./dto");
|
|
22
23
|
let DashboardComponentController = class DashboardComponentController {
|
|
@@ -26,8 +27,9 @@ let DashboardComponentController = class DashboardComponentController {
|
|
|
26
27
|
getAllComponents(paginationParams) {
|
|
27
28
|
return this.dashboardComponentService.getAllComponents(paginationParams);
|
|
28
29
|
}
|
|
29
|
-
getAllComponentsByUserRole(paginationParams, { id }) {
|
|
30
|
-
return this.dashboardComponentService.getAllComponentsByUserRole(paginationParams,
|
|
30
|
+
getAllComponentsByUserRole(paginationParams, { id }, librarySlug, exclude) {
|
|
31
|
+
return this.dashboardComponentService.getAllComponentsByUserRole(Object.assign(Object.assign({}, paginationParams), { librarySlug,
|
|
32
|
+
exclude }), id);
|
|
31
33
|
}
|
|
32
34
|
getComponent(id, locale, { id: userId }) {
|
|
33
35
|
return this.dashboardComponentService.getComponent(id, locale, userId);
|
|
@@ -41,6 +43,9 @@ let DashboardComponentController = class DashboardComponentController {
|
|
|
41
43
|
deleteComponent(id, locale) {
|
|
42
44
|
return this.dashboardComponentService.deleteComponent(id, locale);
|
|
43
45
|
}
|
|
46
|
+
savePreview(id, file, locale) {
|
|
47
|
+
return this.dashboardComponentService.savePreview(id, file, locale);
|
|
48
|
+
}
|
|
44
49
|
};
|
|
45
50
|
exports.DashboardComponentController = DashboardComponentController;
|
|
46
51
|
__decorate([
|
|
@@ -54,8 +59,10 @@ __decorate([
|
|
|
54
59
|
(0, common_1.Get)('user'),
|
|
55
60
|
__param(0, (0, api_pagination_1.Pagination)()),
|
|
56
61
|
__param(1, (0, api_1.User)()),
|
|
62
|
+
__param(2, (0, common_1.Query)('librarySlug')),
|
|
63
|
+
__param(3, (0, common_1.Query)('exclude')),
|
|
57
64
|
__metadata("design:type", Function),
|
|
58
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
65
|
+
__metadata("design:paramtypes", [Object, Object, String, String]),
|
|
59
66
|
__metadata("design:returntype", void 0)
|
|
60
67
|
], DashboardComponentController.prototype, "getAllComponentsByUserRole", null);
|
|
61
68
|
__decorate([
|
|
@@ -92,6 +99,24 @@ __decorate([
|
|
|
92
99
|
__metadata("design:paramtypes", [Number, String]),
|
|
93
100
|
__metadata("design:returntype", void 0)
|
|
94
101
|
], DashboardComponentController.prototype, "deleteComponent", null);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, common_1.Post)(':id/preview'),
|
|
104
|
+
(0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('file', {
|
|
105
|
+
fileFilter: (req, file, cb) => {
|
|
106
|
+
var _a;
|
|
107
|
+
if (!((_a = file === null || file === void 0 ? void 0 : file.mimetype) === null || _a === void 0 ? void 0 : _a.startsWith('image/'))) {
|
|
108
|
+
return cb(new common_1.BadRequestException('Invalid image file'), false);
|
|
109
|
+
}
|
|
110
|
+
cb(null, true);
|
|
111
|
+
},
|
|
112
|
+
})),
|
|
113
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
114
|
+
__param(1, (0, common_1.UploadedFile)()),
|
|
115
|
+
__param(2, (0, api_locale_1.Locale)()),
|
|
116
|
+
__metadata("design:type", Function),
|
|
117
|
+
__metadata("design:paramtypes", [Number, Object, String]),
|
|
118
|
+
__metadata("design:returntype", void 0)
|
|
119
|
+
], DashboardComponentController.prototype, "savePreview", null);
|
|
95
120
|
exports.DashboardComponentController = DashboardComponentController = __decorate([
|
|
96
121
|
(0, api_1.Role)(),
|
|
97
122
|
(0, common_1.Controller)('dashboard-component'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-component.controller.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA0C;AAC1C,oDAA6C;AAC7C,4DAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"dashboard-component.controller.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA0C;AAC1C,oDAA6C;AAC7C,4DAAqD;AACrD,2CAewB;AACxB,+DAA2D;AAC3D,+EAA0E;AAC1E,+BAGe;AAIR,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA2B;IACpE,CAAC;IAGJ,gBAAgB,CAAe,gBAAgB;QAC7C,OAAO,IAAI,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC3E,CAAC;IAGD,0BAA0B,CACV,gBAAgB,EACtB,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AA;IACd,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;+DAGV;uCA1EU,4BAA4B;IAFxC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,qBAAqB,CAAC;IAG7B,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,uDAAyB,CAAC,CAAC,CAAA;qCACR,uDAAyB;GAH5D,4BAA4B,CA2ExC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
2
2
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
3
|
import { CreateDashboardComponentDTO, UpdateDashboardComponentDTO } from './dto';
|
|
4
|
+
type DashboardComponentUserPagination = PaginationDTO & {
|
|
5
|
+
librarySlug?: string;
|
|
6
|
+
exclude?: string;
|
|
7
|
+
};
|
|
4
8
|
export declare class DashboardComponentService {
|
|
5
9
|
private readonly prismaService;
|
|
6
10
|
private readonly paginationService;
|
|
@@ -14,7 +18,8 @@ export declare class DashboardComponentService {
|
|
|
14
18
|
next: number;
|
|
15
19
|
data: any[];
|
|
16
20
|
}>;
|
|
17
|
-
getAllComponentsByUserRole(paginationParams:
|
|
21
|
+
getAllComponentsByUserRole(paginationParams: DashboardComponentUserPagination, userId: number): Promise<{
|
|
22
|
+
modules: string[];
|
|
18
23
|
total: any;
|
|
19
24
|
lastPage: number;
|
|
20
25
|
page: number;
|
|
@@ -49,6 +54,7 @@ export declare class DashboardComponentService {
|
|
|
49
54
|
created_at: Date;
|
|
50
55
|
updated_at: Date;
|
|
51
56
|
slug: string;
|
|
57
|
+
library_slug: string;
|
|
52
58
|
min_width: number;
|
|
53
59
|
max_width: number | null;
|
|
54
60
|
min_height: number;
|
|
@@ -82,6 +88,7 @@ export declare class DashboardComponentService {
|
|
|
82
88
|
created_at: Date;
|
|
83
89
|
updated_at: Date;
|
|
84
90
|
slug: string;
|
|
91
|
+
library_slug: string;
|
|
85
92
|
min_width: number;
|
|
86
93
|
max_width: number | null;
|
|
87
94
|
min_height: number;
|
|
@@ -115,6 +122,7 @@ export declare class DashboardComponentService {
|
|
|
115
122
|
created_at: Date;
|
|
116
123
|
updated_at: Date;
|
|
117
124
|
slug: string;
|
|
125
|
+
library_slug: string;
|
|
118
126
|
min_width: number;
|
|
119
127
|
max_width: number | null;
|
|
120
128
|
min_height: number;
|
|
@@ -128,6 +136,7 @@ export declare class DashboardComponentService {
|
|
|
128
136
|
created_at: Date;
|
|
129
137
|
updated_at: Date;
|
|
130
138
|
slug: string;
|
|
139
|
+
library_slug: string;
|
|
131
140
|
min_width: number;
|
|
132
141
|
max_width: number | null;
|
|
133
142
|
min_height: number;
|
|
@@ -135,5 +144,17 @@ export declare class DashboardComponentService {
|
|
|
135
144
|
height: number;
|
|
136
145
|
is_resizable: boolean;
|
|
137
146
|
}>;
|
|
147
|
+
private normalizeComponentIdentity;
|
|
148
|
+
private buildWidgetAssetSlug;
|
|
149
|
+
private resolvePreviewDirectory;
|
|
150
|
+
savePreview(id: number, file: MulterFile, locale: string): Promise<{
|
|
151
|
+
success: boolean;
|
|
152
|
+
componentId: number;
|
|
153
|
+
slug: string;
|
|
154
|
+
library_slug: string;
|
|
155
|
+
fileName: string;
|
|
156
|
+
relativeUrl: string;
|
|
157
|
+
}>;
|
|
138
158
|
}
|
|
159
|
+
export {};
|
|
139
160
|
//# sourceMappingURL=dashboard-component.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-component.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard-component.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.service.ts"],"names":[],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|
|
@@ -17,13 +17,15 @@ const api_locale_1 = require("@hed-hog/api-locale");
|
|
|
17
17
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
18
18
|
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
19
19
|
const common_1 = require("@nestjs/common");
|
|
20
|
+
const fs_1 = require("fs");
|
|
21
|
+
const path_1 = require("path");
|
|
20
22
|
let DashboardComponentService = class DashboardComponentService {
|
|
21
23
|
constructor(prismaService, paginationService) {
|
|
22
24
|
this.prismaService = prismaService;
|
|
23
25
|
this.paginationService = paginationService;
|
|
24
26
|
}
|
|
25
27
|
async getAllComponents(paginationParams) {
|
|
26
|
-
const fields = ['slug'];
|
|
28
|
+
const fields = ['slug', 'library_slug'];
|
|
27
29
|
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
|
28
30
|
if (paginationParams.search) {
|
|
29
31
|
OR.push({
|
|
@@ -67,12 +69,55 @@ let DashboardComponentService = class DashboardComponentService {
|
|
|
67
69
|
}, 'dashboardComponent');
|
|
68
70
|
}
|
|
69
71
|
async getAllComponentsByUserRole(paginationParams, userId) {
|
|
72
|
+
var _a, _b;
|
|
70
73
|
const userRoles = await this.prismaService.role_user.findMany({
|
|
71
74
|
where: { user_id: userId },
|
|
72
75
|
select: { role_id: true },
|
|
73
76
|
});
|
|
74
77
|
const userRoleIds = userRoles.map((ur) => ur.role_id);
|
|
75
|
-
|
|
78
|
+
if (userRoleIds.length === 0) {
|
|
79
|
+
const emptyResult = await this.paginationService.paginate(this.prismaService.dashboard_component, paginationParams, {
|
|
80
|
+
include: {
|
|
81
|
+
dashboard_component_locale: {
|
|
82
|
+
include: {
|
|
83
|
+
locale: true,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
dashboard_component_role: {
|
|
87
|
+
include: {
|
|
88
|
+
role: {
|
|
89
|
+
include: {
|
|
90
|
+
role_locale: {
|
|
91
|
+
include: {
|
|
92
|
+
locale: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
where: {
|
|
101
|
+
id: -1,
|
|
102
|
+
},
|
|
103
|
+
orderBy: {
|
|
104
|
+
created_at: 'desc',
|
|
105
|
+
},
|
|
106
|
+
}, 'dashboardComponent');
|
|
107
|
+
return Object.assign(Object.assign({}, emptyResult), { modules: [] });
|
|
108
|
+
}
|
|
109
|
+
const requestedLibrarySlug = (_a = paginationParams.librarySlug) === null || _a === void 0 ? void 0 : _a.trim();
|
|
110
|
+
const excludedComponents = ((_b = paginationParams.exclude) !== null && _b !== void 0 ? _b : '')
|
|
111
|
+
.split(',')
|
|
112
|
+
.map((value) => value.trim())
|
|
113
|
+
.filter(Boolean)
|
|
114
|
+
.map((value) => {
|
|
115
|
+
const slugParts = value.split('.').filter(Boolean);
|
|
116
|
+
const baseSlug = slugParts[slugParts.length - 1] || value;
|
|
117
|
+
const librarySlug = slugParts.length > 1 ? slugParts[0] : undefined;
|
|
118
|
+
return Object.assign({ slug: baseSlug }, (librarySlug ? { library_slug: librarySlug } : {}));
|
|
119
|
+
});
|
|
120
|
+
const fields = ['slug', 'library_slug'];
|
|
76
121
|
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
|
77
122
|
if (paginationParams.search) {
|
|
78
123
|
OR.push({
|
|
@@ -86,47 +131,77 @@ let DashboardComponentService = class DashboardComponentService {
|
|
|
86
131
|
},
|
|
87
132
|
});
|
|
88
133
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
dashboard_component_locale: {
|
|
92
|
-
include: {
|
|
93
|
-
locale: true,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
134
|
+
const baseFilters = [
|
|
135
|
+
{
|
|
96
136
|
dashboard_component_role: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
role_locale: {
|
|
101
|
-
include: {
|
|
102
|
-
locale: true,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
137
|
+
some: {
|
|
138
|
+
role_id: {
|
|
139
|
+
in: userRoleIds,
|
|
106
140
|
},
|
|
107
141
|
},
|
|
108
142
|
},
|
|
109
143
|
},
|
|
110
|
-
|
|
111
|
-
|
|
144
|
+
...(OR.length > 0 ? [{ OR }] : []),
|
|
145
|
+
...(excludedComponents.length > 0
|
|
146
|
+
? [
|
|
112
147
|
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
148
|
+
NOT: {
|
|
149
|
+
OR: excludedComponents,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
]
|
|
153
|
+
: []),
|
|
154
|
+
];
|
|
155
|
+
const [paginatedResult, modules] = await Promise.all([
|
|
156
|
+
this.paginationService.paginate(this.prismaService.dashboard_component, paginationParams, {
|
|
157
|
+
include: {
|
|
158
|
+
dashboard_component_locale: {
|
|
159
|
+
include: {
|
|
160
|
+
locale: true,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
dashboard_component_role: {
|
|
164
|
+
include: {
|
|
165
|
+
role: {
|
|
166
|
+
include: {
|
|
167
|
+
role_locale: {
|
|
168
|
+
include: {
|
|
169
|
+
locale: true,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
117
172
|
},
|
|
118
173
|
},
|
|
119
174
|
},
|
|
120
175
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
176
|
+
},
|
|
177
|
+
where: {
|
|
178
|
+
AND: [
|
|
179
|
+
...baseFilters,
|
|
180
|
+
...(requestedLibrarySlug
|
|
181
|
+
? [{ library_slug: requestedLibrarySlug }]
|
|
182
|
+
: []),
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
orderBy: {
|
|
186
|
+
created_at: 'desc',
|
|
187
|
+
},
|
|
188
|
+
}, 'dashboardComponent'),
|
|
189
|
+
this.prismaService.dashboard_component.findMany({
|
|
190
|
+
where: {
|
|
191
|
+
AND: baseFilters,
|
|
192
|
+
},
|
|
193
|
+
select: {
|
|
194
|
+
library_slug: true,
|
|
195
|
+
},
|
|
196
|
+
distinct: ['library_slug'],
|
|
197
|
+
orderBy: {
|
|
198
|
+
library_slug: 'asc',
|
|
199
|
+
},
|
|
200
|
+
}),
|
|
201
|
+
]);
|
|
202
|
+
return Object.assign(Object.assign({}, paginatedResult), { modules: modules
|
|
203
|
+
.map((component) => component.library_slug)
|
|
204
|
+
.filter((value) => Boolean(value)) });
|
|
130
205
|
}
|
|
131
206
|
async getComponent(id, locale, userId) {
|
|
132
207
|
if (userId) {
|
|
@@ -189,9 +264,11 @@ let DashboardComponentService = class DashboardComponentService {
|
|
|
189
264
|
}
|
|
190
265
|
async createComponent(data, locale) {
|
|
191
266
|
var _a;
|
|
267
|
+
const normalized = this.normalizeComponentIdentity(data.slug, data.library_slug);
|
|
192
268
|
const component = await this.prismaService.dashboard_component.create({
|
|
193
269
|
data: {
|
|
194
|
-
slug:
|
|
270
|
+
slug: normalized.slug,
|
|
271
|
+
library_slug: normalized.library_slug,
|
|
195
272
|
min_width: data.min_width,
|
|
196
273
|
max_width: data.max_width,
|
|
197
274
|
min_height: data.min_height,
|
|
@@ -221,10 +298,17 @@ let DashboardComponentService = class DashboardComponentService {
|
|
|
221
298
|
return this.getComponent(component.id, locale);
|
|
222
299
|
}
|
|
223
300
|
async updateComponent(id, data, locale) {
|
|
301
|
+
const normalized = data.slug
|
|
302
|
+
? this.normalizeComponentIdentity(data.slug, data.library_slug)
|
|
303
|
+
: {
|
|
304
|
+
slug: undefined,
|
|
305
|
+
library_slug: data.library_slug,
|
|
306
|
+
};
|
|
224
307
|
await this.prismaService.dashboard_component.update({
|
|
225
308
|
where: { id },
|
|
226
309
|
data: {
|
|
227
|
-
slug:
|
|
310
|
+
slug: normalized.slug,
|
|
311
|
+
library_slug: normalized.library_slug,
|
|
228
312
|
min_width: data.min_width,
|
|
229
313
|
max_width: data.max_width,
|
|
230
314
|
min_height: data.min_height,
|
|
@@ -267,6 +351,72 @@ let DashboardComponentService = class DashboardComponentService {
|
|
|
267
351
|
where: { id },
|
|
268
352
|
});
|
|
269
353
|
}
|
|
354
|
+
normalizeComponentIdentity(slug, librarySlug) {
|
|
355
|
+
const slugParts = slug.split('.').filter(Boolean);
|
|
356
|
+
const baseSlug = slugParts.length > 0 ? slugParts[slugParts.length - 1] : slug;
|
|
357
|
+
const resolvedLibrarySlug = librarySlug || (slugParts.length > 1 ? slugParts[0] : 'core');
|
|
358
|
+
return {
|
|
359
|
+
slug: baseSlug,
|
|
360
|
+
library_slug: resolvedLibrarySlug,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
buildWidgetAssetSlug(slug, librarySlug) {
|
|
364
|
+
const normalized = this.normalizeComponentIdentity(slug, librarySlug);
|
|
365
|
+
return normalized.slug;
|
|
366
|
+
}
|
|
367
|
+
resolvePreviewDirectory() {
|
|
368
|
+
const cwd = process.cwd();
|
|
369
|
+
const candidates = [
|
|
370
|
+
(0, path_1.resolve)(cwd, 'libraries/core/hedhog/frontend/public/dashboard-previews'),
|
|
371
|
+
(0, path_1.resolve)(cwd, '../libraries/core/hedhog/frontend/public/dashboard-previews'),
|
|
372
|
+
(0, path_1.resolve)(cwd, '../../libraries/core/hedhog/frontend/public/dashboard-previews'),
|
|
373
|
+
];
|
|
374
|
+
for (const candidate of candidates) {
|
|
375
|
+
const parentDirectory = (0, path_1.resolve)(candidate, '..');
|
|
376
|
+
if ((0, fs_1.existsSync)(parentDirectory)) {
|
|
377
|
+
return candidate;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return candidates[0];
|
|
381
|
+
}
|
|
382
|
+
async savePreview(id, file, locale) {
|
|
383
|
+
var _a;
|
|
384
|
+
const isDevelopment = process.env.NODE_ENV !== 'production';
|
|
385
|
+
if (!isDevelopment) {
|
|
386
|
+
throw new common_1.ForbiddenException((0, api_locale_1.getLocaleText)('dashboardPreviewOnlyInDevelopment', locale, 'Preview capture is only available in development environment'));
|
|
387
|
+
}
|
|
388
|
+
if (!file || !file.buffer) {
|
|
389
|
+
throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('dashboardPreviewFileRequired', locale, 'Preview image file is required'));
|
|
390
|
+
}
|
|
391
|
+
if (!((_a = file.mimetype) === null || _a === void 0 ? void 0 : _a.startsWith('image/'))) {
|
|
392
|
+
throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('dashboardPreviewInvalidFileType', locale, 'Preview file must be an image'));
|
|
393
|
+
}
|
|
394
|
+
const component = await this.prismaService.dashboard_component.findUnique({
|
|
395
|
+
where: { id },
|
|
396
|
+
select: {
|
|
397
|
+
id: true,
|
|
398
|
+
slug: true,
|
|
399
|
+
library_slug: true,
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
if (!component) {
|
|
403
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('dashboardComponentNotFound', locale, 'Dashboard component not found'));
|
|
404
|
+
}
|
|
405
|
+
const previewDirectory = this.resolvePreviewDirectory();
|
|
406
|
+
await fs_1.promises.mkdir(previewDirectory, { recursive: true });
|
|
407
|
+
const assetSlug = this.buildWidgetAssetSlug(component.slug, component.library_slug);
|
|
408
|
+
const fileName = `${assetSlug}.png`;
|
|
409
|
+
const outputPath = (0, path_1.join)(previewDirectory, fileName);
|
|
410
|
+
await fs_1.promises.writeFile(outputPath, file.buffer);
|
|
411
|
+
return {
|
|
412
|
+
success: true,
|
|
413
|
+
componentId: component.id,
|
|
414
|
+
slug: component.slug,
|
|
415
|
+
library_slug: component.library_slug,
|
|
416
|
+
fileName,
|
|
417
|
+
relativeUrl: `/libraries/${component.library_slug}/dashboard-previews/${fileName}`,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
270
420
|
};
|
|
271
421
|
exports.DashboardComponentService = DashboardComponentService;
|
|
272
422
|
exports.DashboardComponentService = DashboardComponentService = __decorate([
|