@hed-hog/core 0.0.169 → 0.0.170

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.
Files changed (44) hide show
  1. package/dist/dashboard/dashboard/dashboard.controller.d.ts +3 -15
  2. package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
  3. package/dist/dashboard/dashboard/dashboard.service.d.ts +3 -15
  4. package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
  5. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +6 -78
  6. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
  7. package/dist/dashboard/dashboard-component/dashboard-component.controller.js +8 -6
  8. package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
  9. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +3 -79
  10. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
  11. package/dist/dashboard/dashboard-component/dashboard-component.service.js +55 -13
  12. package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
  13. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +0 -4
  14. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
  15. package/dist/dashboard/dashboard-component/dto/create.dto.js +0 -19
  16. package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
  17. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +0 -4
  18. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
  19. package/dist/dashboard/dashboard-component/dto/update.dto.js +0 -20
  20. package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
  21. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +36 -22
  22. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
  23. package/dist/dashboard/dashboard-core/dashboard-core.controller.js +0 -9
  24. package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
  25. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +36 -22
  26. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
  27. package/dist/dashboard/dashboard-core/dashboard-core.service.js +123 -51
  28. package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
  29. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +0 -4
  30. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
  31. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +0 -4
  32. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
  33. package/hedhog/data/dashboard_component.yaml +16 -16
  34. package/hedhog/data/dashboard_component_role.yaml +48 -0
  35. package/hedhog/data/dashboard_item.yaml +28 -28
  36. package/hedhog/data/menu.yaml +3 -3
  37. package/hedhog/table/dashboard_component_role.yaml +16 -0
  38. package/package.json +2 -2
  39. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +9 -5
  40. package/src/dashboard/dashboard-component/dashboard-component.service.ts +64 -14
  41. package/src/dashboard/dashboard-component/dto/create.dto.ts +0 -15
  42. package/src/dashboard/dashboard-component/dto/update.dto.ts +0 -16
  43. package/src/dashboard/dashboard-core/dashboard-core.controller.ts +0 -5
  44. package/src/dashboard/dashboard-core/dashboard-core.service.ts +152 -54
@@ -28,28 +28,24 @@ export declare class DashboardController {
28
28
  } & {
29
29
  name: string;
30
30
  id: number;
31
- description: string | null;
31
+ description: string;
32
32
  created_at: Date;
33
33
  updated_at: Date;
34
34
  locale_id: number;
35
35
  dashboard_component_id: number;
36
36
  })[];
37
37
  } & {
38
- path: string;
39
38
  width: number;
40
39
  id: number;
41
40
  created_at: Date;
42
41
  updated_at: Date;
43
42
  slug: string;
44
- icon: string | null;
45
- color: string | null;
46
43
  min_width: number;
47
44
  max_width: number | null;
48
45
  min_height: number;
49
46
  max_height: number | null;
50
47
  height: number;
51
48
  is_resizable: boolean;
52
- stat_key: string | null;
53
49
  };
54
50
  } & {
55
51
  width: number;
@@ -102,28 +98,24 @@ export declare class DashboardController {
102
98
  } & {
103
99
  name: string;
104
100
  id: number;
105
- description: string | null;
101
+ description: string;
106
102
  created_at: Date;
107
103
  updated_at: Date;
108
104
  locale_id: number;
109
105
  dashboard_component_id: number;
110
106
  })[];
111
107
  } & {
112
- path: string;
113
108
  width: number;
114
109
  id: number;
115
110
  created_at: Date;
116
111
  updated_at: Date;
117
112
  slug: string;
118
- icon: string | null;
119
- color: string | null;
120
113
  min_width: number;
121
114
  max_width: number | null;
122
115
  min_height: number;
123
116
  max_height: number | null;
124
117
  height: number;
125
118
  is_resizable: boolean;
126
- stat_key: string | null;
127
119
  };
128
120
  } & {
129
121
  width: number;
@@ -176,28 +168,24 @@ export declare class DashboardController {
176
168
  } & {
177
169
  name: string;
178
170
  id: number;
179
- description: string | null;
171
+ description: string;
180
172
  created_at: Date;
181
173
  updated_at: Date;
182
174
  locale_id: number;
183
175
  dashboard_component_id: number;
184
176
  })[];
185
177
  } & {
186
- path: string;
187
178
  width: number;
188
179
  id: number;
189
180
  created_at: Date;
190
181
  updated_at: Date;
191
182
  slug: string;
192
- icon: string | null;
193
- color: string | null;
194
183
  min_width: number;
195
184
  max_width: number | null;
196
185
  min_height: number;
197
186
  max_height: number | null;
198
187
  height: number;
199
188
  is_resizable: boolean;
200
- stat_key: string | null;
201
189
  };
202
190
  } & {
203
191
  width: number;
@@ -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,qBAEa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAG/D,gBAAgB,CAAe,gBAAgB,KAAA;;;;;;;;;IAK/C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AI,EAAE,kBAAkB,EACtB,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAM1B,eAAe,CAA4B,EAAE,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM;;;CAGhF"}
@@ -30,28 +30,24 @@ export declare class DashboardService {
30
30
  } & {
31
31
  name: string;
32
32
  id: number;
33
- description: string | null;
33
+ description: string;
34
34
  created_at: Date;
35
35
  updated_at: Date;
36
36
  locale_id: number;
37
37
  dashboard_component_id: number;
38
38
  })[];
39
39
  } & {
40
- path: string;
41
40
  width: number;
42
41
  id: number;
43
42
  created_at: Date;
44
43
  updated_at: Date;
45
44
  slug: string;
46
- icon: string | null;
47
- color: string | null;
48
45
  min_width: number;
49
46
  max_width: number | null;
50
47
  min_height: number;
51
48
  max_height: number | null;
52
49
  height: number;
53
50
  is_resizable: boolean;
54
- stat_key: string | null;
55
51
  };
56
52
  } & {
57
53
  width: number;
@@ -104,28 +100,24 @@ export declare class DashboardService {
104
100
  } & {
105
101
  name: string;
106
102
  id: number;
107
- description: string | null;
103
+ description: string;
108
104
  created_at: Date;
109
105
  updated_at: Date;
110
106
  locale_id: number;
111
107
  dashboard_component_id: number;
112
108
  })[];
113
109
  } & {
114
- path: string;
115
110
  width: number;
116
111
  id: number;
117
112
  created_at: Date;
118
113
  updated_at: Date;
119
114
  slug: string;
120
- icon: string | null;
121
- color: string | null;
122
115
  min_width: number;
123
116
  max_width: number | null;
124
117
  min_height: number;
125
118
  max_height: number | null;
126
119
  height: number;
127
120
  is_resizable: boolean;
128
- stat_key: string | null;
129
121
  };
130
122
  } & {
131
123
  width: number;
@@ -178,28 +170,24 @@ export declare class DashboardService {
178
170
  } & {
179
171
  name: string;
180
172
  id: number;
181
- description: string | null;
173
+ description: string;
182
174
  created_at: Date;
183
175
  updated_at: Date;
184
176
  locale_id: number;
185
177
  dashboard_component_id: number;
186
178
  })[];
187
179
  } & {
188
- path: string;
189
180
  width: number;
190
181
  id: number;
191
182
  created_at: Date;
192
183
  updated_at: Date;
193
184
  slug: string;
194
- icon: string | null;
195
- color: string | null;
196
185
  min_width: number;
197
186
  max_width: number | null;
198
187
  min_height: number;
199
188
  max_height: number | null;
200
189
  height: number;
201
190
  is_resizable: boolean;
202
- stat_key: string | null;
203
191
  };
204
192
  } & {
205
193
  width: number;
@@ -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;;;;;;;;;IA0CjC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkCvC,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"}
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;;;;;;;;;IA0CjC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkCvC,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"}
@@ -3,7 +3,9 @@ import { CreateDashboardComponentDTO, UpdateDashboardComponentDTO } from './dto'
3
3
  export declare class DashboardComponentController {
4
4
  private readonly dashboardComponentService;
5
5
  constructor(dashboardComponentService: DashboardComponentService);
6
- getAllComponents(paginationParams: any): Promise<{
6
+ getAllComponents(paginationParams: any, { id }: {
7
+ id: any;
8
+ }): Promise<{
7
9
  total: any;
8
10
  lastPage: number;
9
11
  page: number;
@@ -12,133 +14,59 @@ export declare class DashboardComponentController {
12
14
  next: number;
13
15
  data: any[];
14
16
  }>;
15
- getComponent(id: number, locale: string): Promise<{
16
- dashboard_component_locale: ({
17
- locale: {
18
- code: string;
19
- name: string;
20
- region: string;
21
- id: number;
22
- created_at: Date;
23
- updated_at: Date;
24
- enabled: boolean;
25
- };
26
- } & {
27
- name: string;
28
- id: number;
29
- description: string | null;
30
- created_at: Date;
31
- updated_at: Date;
32
- locale_id: number;
33
- dashboard_component_id: number;
34
- })[];
35
- } & {
36
- path: string;
17
+ getComponent(id: number, locale: string, { id: userId }: {
18
+ id: any;
19
+ }): Promise<{
37
20
  width: number;
38
21
  id: number;
39
22
  created_at: Date;
40
23
  updated_at: Date;
41
24
  slug: string;
42
- icon: string | null;
43
- color: string | null;
44
25
  min_width: number;
45
26
  max_width: number | null;
46
27
  min_height: number;
47
28
  max_height: number | null;
48
29
  height: number;
49
30
  is_resizable: boolean;
50
- stat_key: string | null;
51
31
  }>;
52
32
  createComponent(data: CreateDashboardComponentDTO, locale: string): Promise<{
53
- dashboard_component_locale: ({
54
- locale: {
55
- code: string;
56
- name: string;
57
- region: string;
58
- id: number;
59
- created_at: Date;
60
- updated_at: Date;
61
- enabled: boolean;
62
- };
63
- } & {
64
- name: string;
65
- id: number;
66
- description: string | null;
67
- created_at: Date;
68
- updated_at: Date;
69
- locale_id: number;
70
- dashboard_component_id: number;
71
- })[];
72
- } & {
73
- path: string;
74
33
  width: number;
75
34
  id: number;
76
35
  created_at: Date;
77
36
  updated_at: Date;
78
37
  slug: string;
79
- icon: string | null;
80
- color: string | null;
81
38
  min_width: number;
82
39
  max_width: number | null;
83
40
  min_height: number;
84
41
  max_height: number | null;
85
42
  height: number;
86
43
  is_resizable: boolean;
87
- stat_key: string | null;
88
44
  }>;
89
45
  updateComponent(id: number, data: UpdateDashboardComponentDTO, locale: string): Promise<{
90
- dashboard_component_locale: ({
91
- locale: {
92
- code: string;
93
- name: string;
94
- region: string;
95
- id: number;
96
- created_at: Date;
97
- updated_at: Date;
98
- enabled: boolean;
99
- };
100
- } & {
101
- name: string;
102
- id: number;
103
- description: string | null;
104
- created_at: Date;
105
- updated_at: Date;
106
- locale_id: number;
107
- dashboard_component_id: number;
108
- })[];
109
- } & {
110
- path: string;
111
46
  width: number;
112
47
  id: number;
113
48
  created_at: Date;
114
49
  updated_at: Date;
115
50
  slug: string;
116
- icon: string | null;
117
- color: string | null;
118
51
  min_width: number;
119
52
  max_width: number | null;
120
53
  min_height: number;
121
54
  max_height: number | null;
122
55
  height: number;
123
56
  is_resizable: boolean;
124
- stat_key: string | null;
125
57
  }>;
126
58
  deleteComponent(id: number, locale: string): Promise<{
127
- path: string;
128
59
  width: number;
129
60
  id: number;
130
61
  created_at: Date;
131
62
  updated_at: Date;
132
63
  slug: string;
133
- icon: string | null;
134
- color: string | null;
135
64
  min_width: number;
136
65
  max_width: number | null;
137
66
  min_height: number;
138
67
  max_height: number | null;
139
68
  height: number;
140
69
  is_resizable: boolean;
141
- stat_key: string | null;
142
70
  }>;
143
71
  }
144
72
  //# 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":"AAeA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,OAAO,CAAC;AAEf,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIvE,gBAAgB,CAAe,gBAAgB,KAAA;;;;;;;;;IAK/C,YAAY,CAA4B,EAAE,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK5E,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;;;;;;;;;;;;;;;;;CAGhF"}
1
+ {"version":3,"file":"dashboard-component.controller.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,OAAO,CAAC;AAEf,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIvE,gBAAgB,CAAe,gBAAgB,KAAA,EAAU,EAAE,EAAE,EAAE;;KAAA;;;;;;;;;IAK/D,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;;;;;;;;;;;;;CAGhF"}
@@ -23,11 +23,11 @@ let DashboardComponentController = class DashboardComponentController {
23
23
  constructor(dashboardComponentService) {
24
24
  this.dashboardComponentService = dashboardComponentService;
25
25
  }
26
- getAllComponents(paginationParams) {
27
- return this.dashboardComponentService.getAllComponents(paginationParams);
26
+ getAllComponents(paginationParams, { id }) {
27
+ return this.dashboardComponentService.getAllComponents(paginationParams, id);
28
28
  }
29
- getComponent(id, locale) {
30
- return this.dashboardComponentService.getComponent(id, locale);
29
+ getComponent(id, locale, { id: userId }) {
30
+ return this.dashboardComponentService.getComponent(id, locale, userId);
31
31
  }
32
32
  createComponent(data, locale) {
33
33
  return this.dashboardComponentService.createComponent(data, locale);
@@ -43,16 +43,18 @@ exports.DashboardComponentController = DashboardComponentController;
43
43
  __decorate([
44
44
  (0, common_1.Get)(),
45
45
  __param(0, (0, api_pagination_1.Pagination)()),
46
+ __param(1, (0, api_1.User)()),
46
47
  __metadata("design:type", Function),
47
- __metadata("design:paramtypes", [Object]),
48
+ __metadata("design:paramtypes", [Object, Object]),
48
49
  __metadata("design:returntype", void 0)
49
50
  ], DashboardComponentController.prototype, "getAllComponents", null);
50
51
  __decorate([
51
52
  (0, common_1.Get)(':id'),
52
53
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
53
54
  __param(1, (0, api_locale_1.Locale)()),
55
+ __param(2, (0, api_1.User)()),
54
56
  __metadata("design:type", Function),
55
- __metadata("design:paramtypes", [Number, String]),
57
+ __metadata("design:paramtypes", [Number, String, Object]),
56
58
  __metadata("design:returntype", void 0)
57
59
  ], DashboardComponentController.prototype, "getComponent", null);
58
60
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-component.controller.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component/dashboard-component.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAoC;AACpC,oDAA6C;AAC7C,4DAAqD;AACrD,2CAWwB;AACxB,+EAA0E;AAC1E,+BAGe;AAIR,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA2B;IACpE,C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CADK,iCAA2B;;mEAI1C;AAGD;IADC,IAAA,eAAM,EAAC,KAAK,CAAC;IACG,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IAAc,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;mEAE/D;uCAjCU,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,CAkCxC"}
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,2CAWwB;AACxB,+EAA0E;AAC1E,+BAGe;AAIR,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA2B;IACpE,CAAC;IAGJ,gBAAgB,CAAe,gBAAgB,EAAU,EAAE,EAAE,EAAE;QAC7D,OAAO,IAAI,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC/E,CAAC;IAGD,YAAY,CACiB,EAAU,EAC3B,MAAc,EAChB,EAAE,EAAE,EAAE,MAAM,EAAE;QAEtB,OAAO,IAAI,CAAC,yBAAyB,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;IAGD,eAAe,CAAS,IAAiC,EAAY,MAAc;QACjF,OAAO,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAGD,eAAe,CACc,EAAU,EAC7B,IAAiC,EAC/B,MAAc;QAExB,OAAO,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B,CAsCxC"}
@@ -1,11 +1,11 @@
1
- import { PaginationService } from '@hed-hog/api-pagination';
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
4
  export declare class DashboardComponentService {
5
5
  private readonly prismaService;
6
6
  private readonly paginationService;
7
7
  constructor(prismaService: PrismaService, paginationService: PaginationService);
8
- getAllComponents(paginationParams: any): Promise<{
8
+ getAllComponents(paginationParams: PaginationDTO, userId: number): Promise<{
9
9
  total: any;
10
10
  lastPage: number;
11
11
  page: number;
@@ -14,133 +14,57 @@ export declare class DashboardComponentService {
14
14
  next: number;
15
15
  data: any[];
16
16
  }>;
17
- getComponent(id: number, locale: string): Promise<{
18
- dashboard_component_locale: ({
19
- locale: {
20
- code: string;
21
- name: string;
22
- region: string;
23
- id: number;
24
- created_at: Date;
25
- updated_at: Date;
26
- enabled: boolean;
27
- };
28
- } & {
29
- name: string;
30
- id: number;
31
- description: string | null;
32
- created_at: Date;
33
- updated_at: Date;
34
- locale_id: number;
35
- dashboard_component_id: number;
36
- })[];
37
- } & {
38
- path: string;
17
+ getComponent(id: number, locale: string, userId?: number): Promise<{
39
18
  width: number;
40
19
  id: number;
41
20
  created_at: Date;
42
21
  updated_at: Date;
43
22
  slug: string;
44
- icon: string | null;
45
- color: string | null;
46
23
  min_width: number;
47
24
  max_width: number | null;
48
25
  min_height: number;
49
26
  max_height: number | null;
50
27
  height: number;
51
28
  is_resizable: boolean;
52
- stat_key: string | null;
53
29
  }>;
54
30
  createComponent(data: CreateDashboardComponentDTO, locale: string): Promise<{
55
- dashboard_component_locale: ({
56
- locale: {
57
- code: string;
58
- name: string;
59
- region: string;
60
- id: number;
61
- created_at: Date;
62
- updated_at: Date;
63
- enabled: boolean;
64
- };
65
- } & {
66
- name: string;
67
- id: number;
68
- description: string | null;
69
- created_at: Date;
70
- updated_at: Date;
71
- locale_id: number;
72
- dashboard_component_id: number;
73
- })[];
74
- } & {
75
- path: string;
76
31
  width: number;
77
32
  id: number;
78
33
  created_at: Date;
79
34
  updated_at: Date;
80
35
  slug: string;
81
- icon: string | null;
82
- color: string | null;
83
36
  min_width: number;
84
37
  max_width: number | null;
85
38
  min_height: number;
86
39
  max_height: number | null;
87
40
  height: number;
88
41
  is_resizable: boolean;
89
- stat_key: string | null;
90
42
  }>;
91
43
  updateComponent(id: number, data: UpdateDashboardComponentDTO, locale: string): Promise<{
92
- dashboard_component_locale: ({
93
- locale: {
94
- code: string;
95
- name: string;
96
- region: string;
97
- id: number;
98
- created_at: Date;
99
- updated_at: Date;
100
- enabled: boolean;
101
- };
102
- } & {
103
- name: string;
104
- id: number;
105
- description: string | null;
106
- created_at: Date;
107
- updated_at: Date;
108
- locale_id: number;
109
- dashboard_component_id: number;
110
- })[];
111
- } & {
112
- path: string;
113
44
  width: number;
114
45
  id: number;
115
46
  created_at: Date;
116
47
  updated_at: Date;
117
48
  slug: string;
118
- icon: string | null;
119
- color: string | null;
120
49
  min_width: number;
121
50
  max_width: number | null;
122
51
  min_height: number;
123
52
  max_height: number | null;
124
53
  height: number;
125
54
  is_resizable: boolean;
126
- stat_key: string | null;
127
55
  }>;
128
56
  deleteComponent(id: number, locale: string): Promise<{
129
- path: string;
130
57
  width: number;
131
58
  id: number;
132
59
  created_at: Date;
133
60
  updated_at: Date;
134
61
  slug: string;
135
- icon: string | null;
136
- color: string | null;
137
62
  min_width: number;
138
63
  max_width: number | null;
139
64
  min_height: number;
140
65
  max_height: number | null;
141
66
  height: number;
142
67
  is_resizable: boolean;
143
- stat_key: string | null;
144
68
  }>;
145
69
  }
146
70
  //# 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,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,OAAO,CAAC;AACf,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,gBAAgB,CAAC,gBAAgB,KAAA;;;;;;;;;IA0CjC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqBvC,eAAe,CAAC,IAAI,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwCjE,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6C7E,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;CAejD"}
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;AAOpD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,OAAO,CAAC;AACf,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,gBAAgB,CAAC,gBAAgB,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM;;;;;;;;;IA+DhE,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;;;;;;;;;;;;;IA0DxD,eAAe,CAAC,IAAI,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;IAoCjE,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;IAyC7E,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;CAejD"}
@@ -22,7 +22,12 @@ let DashboardComponentService = class DashboardComponentService {
22
22
  this.prismaService = prismaService;
23
23
  this.paginationService = paginationService;
24
24
  }
25
- async getAllComponents(paginationParams) {
25
+ async getAllComponents(paginationParams, userId) {
26
+ const userRoles = await this.prismaService.user_role.findMany({
27
+ where: { user_id: userId },
28
+ select: { role_id: true },
29
+ });
30
+ const userRoleIds = userRoles.map((ur) => ur.role_id);
26
31
  const fields = ['slug'];
27
32
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
28
33
  if (paginationParams.search) {
@@ -46,14 +51,59 @@ let DashboardComponentService = class DashboardComponentService {
46
51
  },
47
52
  },
48
53
  where: {
49
- OR
54
+ AND: [
55
+ {
56
+ // @ts-ignore
57
+ dashboard_component_role: {
58
+ some: {
59
+ role_id: {
60
+ in: userRoleIds,
61
+ },
62
+ },
63
+ },
64
+ },
65
+ {
66
+ OR,
67
+ },
68
+ ],
50
69
  },
51
70
  orderBy: {
52
71
  created_at: 'desc',
53
72
  },
54
73
  }, 'dashboardComponent');
55
74
  }
56
- async getComponent(id, locale) {
75
+ async getComponent(id, locale, userId) {
76
+ if (userId) {
77
+ const userRoles = await this.prismaService.user_role.findMany({
78
+ where: { user_id: userId },
79
+ select: { role_id: true },
80
+ });
81
+ const userRoleIds = userRoles.map((ur) => ur.role_id);
82
+ const component = await this.prismaService.dashboard_component.findFirst({
83
+ where: {
84
+ id,
85
+ // @ts-ignore
86
+ dashboard_component_role: {
87
+ some: {
88
+ role_id: {
89
+ in: userRoleIds,
90
+ },
91
+ },
92
+ },
93
+ },
94
+ include: {
95
+ dashboard_component_locale: {
96
+ include: {
97
+ locale: true,
98
+ },
99
+ },
100
+ },
101
+ });
102
+ if (!component) {
103
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('dashboardComponentNotFound', locale, 'Dashboard component not found'));
104
+ }
105
+ return component;
106
+ }
57
107
  const component = await this.prismaService.dashboard_component.findUnique({
58
108
  where: { id },
59
109
  include: {
@@ -74,7 +124,6 @@ let DashboardComponentService = class DashboardComponentService {
74
124
  const component = await this.prismaService.dashboard_component.create({
75
125
  data: {
76
126
  slug: data.slug,
77
- path: data.path,
78
127
  min_width: data.min_width,
79
128
  max_width: data.max_width,
80
129
  min_height: data.min_height,
@@ -82,9 +131,6 @@ let DashboardComponentService = class DashboardComponentService {
82
131
  width: data.width,
83
132
  height: data.height,
84
133
  is_resizable: (_a = data.is_resizable) !== null && _a !== void 0 ? _a : true,
85
- stat_key: data.stat_key || null,
86
- icon: data.icon || null,
87
- color: data.color || null,
88
134
  },
89
135
  });
90
136
  if (data.locale) {
@@ -98,7 +144,7 @@ let DashboardComponentService = class DashboardComponentService {
98
144
  dashboard_component_id: component.id,
99
145
  locale_id: localeRecord.id,
100
146
  name: localeData.name,
101
- description: localeData.description || null,
147
+ description: localeData.description || '',
102
148
  },
103
149
  });
104
150
  }
@@ -111,7 +157,6 @@ let DashboardComponentService = class DashboardComponentService {
111
157
  where: { id },
112
158
  data: {
113
159
  slug: data.slug,
114
- path: data.path,
115
160
  min_width: data.min_width,
116
161
  max_width: data.max_width,
117
162
  min_height: data.min_height,
@@ -119,9 +164,6 @@ let DashboardComponentService = class DashboardComponentService {
119
164
  width: data.width,
120
165
  height: data.height,
121
166
  is_resizable: data.is_resizable,
122
- stat_key: data.stat_key,
123
- icon: data.icon,
124
- color: data.color,
125
167
  },
126
168
  });
127
169
  if (data.locale) {
@@ -138,7 +180,7 @@ let DashboardComponentService = class DashboardComponentService {
138
180
  dashboard_component_id: id,
139
181
  locale_id: localeRecord.id,
140
182
  name: localeData.name,
141
- description: localeData.description || null,
183
+ description: localeData.description || '',
142
184
  },
143
185
  });
144
186
  }