@hed-hog/core 0.0.163 → 0.0.166
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 +13 -1
- package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.js +3 -4
- package/dist/dashboard/dashboard/dashboard.controller.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.d.ts +14 -4
- package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.js +20 -10
- package/dist/dashboard/dashboard/dashboard.service.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +15 -0
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +15 -2
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +25 -2
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +4 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js +15 -0
- package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +4 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.js +15 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +27 -8
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +8 -6
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +27 -8
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +98 -46
- 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-item/dto/index.d.ts +2 -0
- package/dist/dashboard/dashboard-item/dto/index.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dto/index.js +4 -1
- package/dist/dashboard/dashboard-item/dto/index.js.map +1 -1
- package/dist/dashboard/dashboard-item/dto/update-layout.dto.d.ts +12 -0
- package/dist/dashboard/dashboard-item/dto/update-layout.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dto/update-layout.dto.js +52 -0
- package/dist/dashboard/dashboard-item/dto/update-layout.dto.js.map +1 -0
- package/hedhog/data/menu.yaml +28 -4
- package/hedhog/query/add-description-to-dashboard-component-locale.sql +99 -0
- package/hedhog/query/add-widget-metadata.sql +21 -0
- package/hedhog/query/fix-dashboard-stat-keys.sql +82 -0
- package/package.json +4 -4
- package/src/dashboard/dashboard/dashboard.controller.ts +2 -2
- package/src/dashboard/dashboard/dashboard.service.ts +25 -9
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +30 -3
- package/src/dashboard/dashboard-component/dto/create.dto.ts +13 -1
- package/src/dashboard/dashboard-component/dto/update.dto.ts +13 -1
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +4 -2
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +103 -49
- package/src/dashboard/dashboard-item/dashboard-item.service.ts +4 -4
- package/src/dashboard/dashboard-item/dto/index.ts +2 -0
- package/src/dashboard/dashboard-item/dto/update-layout.dto.ts +30 -0
|
@@ -30,12 +30,15 @@ export declare class DashboardItemService {
|
|
|
30
30
|
created_at: Date;
|
|
31
31
|
updated_at: Date;
|
|
32
32
|
slug: string;
|
|
33
|
+
icon: string | null;
|
|
34
|
+
color: string | null;
|
|
33
35
|
min_width: number;
|
|
34
36
|
max_width: number | null;
|
|
35
37
|
min_height: number;
|
|
36
38
|
max_height: number | null;
|
|
37
39
|
height: number;
|
|
38
40
|
is_resizable: boolean;
|
|
41
|
+
stat_key: string | null;
|
|
39
42
|
};
|
|
40
43
|
} & {
|
|
41
44
|
width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-item.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-item/dashboard-item.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,qBACa,oBAAoB;IAG7B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAJb,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB,EAEpC,aAAa,EAAE,aAAa;IAGzC,oBAAoB,CAAC,gBAAgB,KAAA,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;;;;;IAkC3E,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"dashboard-item.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-item/dashboard-item.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,qBACa,oBAAoB;IAG7B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAJb,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB,EAEpC,aAAa,EAAE,aAAa;IAGzC,oBAAoB,CAAC,gBAAgB,KAAA,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;;;;;IAkC3E,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBhE,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;CAgBrD"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './create.dto';
|
|
2
|
+
export * from './update-layout.dto';
|
|
2
3
|
export * from './update.dto';
|
|
3
4
|
export { CreateDTO as CreateDashboardItemDTO } from './create.dto';
|
|
5
|
+
export { UpdateDashboardLayoutDTO } from './update-layout.dto';
|
|
4
6
|
export { UpdateDTO as UpdateDashboardItemDTO } from './update.dto';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -14,12 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.UpdateDashboardItemDTO = exports.CreateDashboardItemDTO = void 0;
|
|
17
|
+
exports.UpdateDashboardItemDTO = exports.UpdateDashboardLayoutDTO = exports.CreateDashboardItemDTO = void 0;
|
|
18
18
|
__exportStar(require("./create.dto"), exports);
|
|
19
|
+
__exportStar(require("./update-layout.dto"), exports);
|
|
19
20
|
__exportStar(require("./update.dto"), exports);
|
|
20
21
|
// Aliases para compatibilidade
|
|
21
22
|
var create_dto_1 = require("./create.dto");
|
|
22
23
|
Object.defineProperty(exports, "CreateDashboardItemDTO", { enumerable: true, get: function () { return create_dto_1.CreateDTO; } });
|
|
24
|
+
var update_layout_dto_1 = require("./update-layout.dto");
|
|
25
|
+
Object.defineProperty(exports, "UpdateDashboardLayoutDTO", { enumerable: true, get: function () { return update_layout_dto_1.UpdateDashboardLayoutDTO; } });
|
|
23
26
|
var update_dto_1 = require("./update.dto");
|
|
24
27
|
Object.defineProperty(exports, "UpdateDashboardItemDTO", { enumerable: true, get: function () { return update_dto_1.UpdateDTO; } });
|
|
25
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAE7B,+BAA+B;AAC/B,2CAAmE;AAA1D,oHAAA,SAAS,OAA0B;AAC5C,2CAAmE;AAA1D,oHAAA,SAAS,OAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,sDAAoC;AACpC,+CAA6B;AAE7B,+BAA+B;AAC/B,2CAAmE;AAA1D,oHAAA,SAAS,OAA0B;AAC5C,yDAA+D;AAAtD,6HAAA,wBAAwB,OAAA;AACjC,2CAAmE;AAA1D,oHAAA,SAAS,OAA0B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class DashboardItemLayoutDTO {
|
|
2
|
+
id: number;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
x_axis: number;
|
|
6
|
+
y_axis: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class UpdateDashboardLayoutDTO {
|
|
9
|
+
dashboard_id: number;
|
|
10
|
+
items: DashboardItemLayoutDTO[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=update-layout.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-layout.dto.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/update-layout.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,sBAAsB;IAEjC,EAAE,EAAE,MAAM,CAAC;IAGX,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,wBAAwB;IAEnC,YAAY,EAAE,MAAM,CAAC;IAKrB,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateDashboardLayoutDTO = exports.DashboardItemLayoutDTO = void 0;
|
|
13
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
class DashboardItemLayoutDTO {
|
|
17
|
+
}
|
|
18
|
+
exports.DashboardItemLayoutDTO = DashboardItemLayoutDTO;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
21
|
+
__metadata("design:type", Number)
|
|
22
|
+
], DashboardItemLayoutDTO.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], DashboardItemLayoutDTO.prototype, "width", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], DashboardItemLayoutDTO.prototype, "height", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], DashboardItemLayoutDTO.prototype, "x_axis", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], DashboardItemLayoutDTO.prototype, "y_axis", void 0);
|
|
39
|
+
class UpdateDashboardLayoutDTO {
|
|
40
|
+
}
|
|
41
|
+
exports.UpdateDashboardLayoutDTO = UpdateDashboardLayoutDTO;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], UpdateDashboardLayoutDTO.prototype, "dashboard_id", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsArray)({ message: (args) => (0, api_locale_1.getLocaleText)('validation.arrayRequired', args.value) }),
|
|
48
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
49
|
+
(0, class_transformer_1.Type)(() => DashboardItemLayoutDTO),
|
|
50
|
+
__metadata("design:type", Array)
|
|
51
|
+
], UpdateDashboardLayoutDTO.prototype, "items", void 0);
|
|
52
|
+
//# sourceMappingURL=update-layout.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-layout.dto.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/update-layout.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,yDAAyC;AACzC,qDAAoE;AAEpE,MAAa,sBAAsB;CAelC;AAfD,wDAeC;AAbC;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;kDACjF;AAGX;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;qDAC9E;AAGd;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;sDAC7E;AAGf;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;sDAC7E;AAGf;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;sDAC7E;AAGjB,MAAa,wBAAwB;CAQpC;AARD,4DAQC;AANC;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;8DACvE;AAKrB;IAHC,IAAA,yBAAO,EAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,0BAA0B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACrF,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;;uDACH"}
|
package/hedhog/data/menu.yaml
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
|
-
-
|
|
2
|
-
icon: house
|
|
1
|
+
- icon: house
|
|
3
2
|
name:
|
|
4
3
|
en: Dashboard
|
|
5
4
|
pt: Dashboard
|
|
6
|
-
slug: /
|
|
5
|
+
slug: /dashboard
|
|
6
|
+
relations:
|
|
7
|
+
role:
|
|
8
|
+
- where:
|
|
9
|
+
slug: admin
|
|
10
|
+
- menu_id:
|
|
11
|
+
where:
|
|
12
|
+
slug: /dashboard
|
|
13
|
+
url: /dashboard
|
|
14
|
+
icon: house
|
|
15
|
+
name:
|
|
16
|
+
en: Home
|
|
17
|
+
pt: Home
|
|
18
|
+
slug: /dashboard-home
|
|
19
|
+
relations:
|
|
20
|
+
role:
|
|
21
|
+
- where:
|
|
22
|
+
slug: admin
|
|
23
|
+
- menu_id:
|
|
24
|
+
where:
|
|
25
|
+
slug: /dashboard
|
|
26
|
+
url: /dashboard-management
|
|
27
|
+
icon: settings
|
|
28
|
+
name:
|
|
29
|
+
en: Dashboard Management
|
|
30
|
+
pt: Gerenciamento do Dashboard
|
|
31
|
+
slug: /dashboard-management
|
|
7
32
|
relations:
|
|
8
33
|
role:
|
|
9
34
|
- where:
|
|
@@ -73,4 +98,3 @@
|
|
|
73
98
|
role:
|
|
74
99
|
- where:
|
|
75
100
|
slug: admin
|
|
76
|
-
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
-- Add description field to dashboard_component_locale table
|
|
2
|
+
ALTER TABLE "dashboard_component_locale"
|
|
3
|
+
ADD COLUMN IF NOT EXISTS "description" VARCHAR(512);
|
|
4
|
+
|
|
5
|
+
-- Add default descriptions for existing dashboard components
|
|
6
|
+
DO $$
|
|
7
|
+
DECLARE
|
|
8
|
+
v_locale_en_id INT;
|
|
9
|
+
v_locale_pt_id INT;
|
|
10
|
+
v_component_id INT;
|
|
11
|
+
BEGIN
|
|
12
|
+
SELECT id INTO v_locale_en_id FROM locale WHERE code = 'en' LIMIT 1;
|
|
13
|
+
SELECT id INTO v_locale_pt_id FROM locale WHERE code = 'pt' LIMIT 1;
|
|
14
|
+
|
|
15
|
+
-- Total Users component
|
|
16
|
+
SELECT id INTO v_component_id FROM dashboard_component WHERE slug = 'total-users';
|
|
17
|
+
IF v_component_id IS NOT NULL THEN
|
|
18
|
+
UPDATE dashboard_component_locale
|
|
19
|
+
SET description = 'Displays the total number of registered users in the system'
|
|
20
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_en_id;
|
|
21
|
+
|
|
22
|
+
IF v_locale_pt_id IS NOT NULL THEN
|
|
23
|
+
UPDATE dashboard_component_locale
|
|
24
|
+
SET description = 'Exibe o total de usuários registrados no sistema'
|
|
25
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_pt_id;
|
|
26
|
+
END IF;
|
|
27
|
+
END IF;
|
|
28
|
+
|
|
29
|
+
-- Recent Users component
|
|
30
|
+
SELECT id INTO v_component_id FROM dashboard_component WHERE slug = 'recent-users';
|
|
31
|
+
IF v_component_id IS NOT NULL THEN
|
|
32
|
+
UPDATE dashboard_component_locale
|
|
33
|
+
SET description = 'Shows the number of users registered in the last 30 days'
|
|
34
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_en_id;
|
|
35
|
+
|
|
36
|
+
IF v_locale_pt_id IS NOT NULL THEN
|
|
37
|
+
UPDATE dashboard_component_locale
|
|
38
|
+
SET description = 'Mostra o número de usuários registrados nos últimos 30 dias'
|
|
39
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_pt_id;
|
|
40
|
+
END IF;
|
|
41
|
+
END IF;
|
|
42
|
+
|
|
43
|
+
-- Active Users component
|
|
44
|
+
SELECT id INTO v_component_id FROM dashboard_component WHERE slug = 'active-users';
|
|
45
|
+
IF v_component_id IS NOT NULL THEN
|
|
46
|
+
UPDATE dashboard_component_locale
|
|
47
|
+
SET description = 'Number of users who have logged in recently and are active'
|
|
48
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_en_id;
|
|
49
|
+
|
|
50
|
+
IF v_locale_pt_id IS NOT NULL THEN
|
|
51
|
+
UPDATE dashboard_component_locale
|
|
52
|
+
SET description = 'Número de usuários que fizeram login recentemente e estão ativos'
|
|
53
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_pt_id;
|
|
54
|
+
END IF;
|
|
55
|
+
END IF;
|
|
56
|
+
|
|
57
|
+
-- Total Roles component
|
|
58
|
+
SELECT id INTO v_component_id FROM dashboard_component WHERE slug = 'total-roles';
|
|
59
|
+
IF v_component_id IS NOT NULL THEN
|
|
60
|
+
UPDATE dashboard_component_locale
|
|
61
|
+
SET description = 'Shows the total number of roles configured in the system'
|
|
62
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_en_id;
|
|
63
|
+
|
|
64
|
+
IF v_locale_pt_id IS NOT NULL THEN
|
|
65
|
+
UPDATE dashboard_component_locale
|
|
66
|
+
SET description = 'Mostra o total de perfis configurados no sistema'
|
|
67
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_pt_id;
|
|
68
|
+
END IF;
|
|
69
|
+
END IF;
|
|
70
|
+
|
|
71
|
+
-- Total Menus component
|
|
72
|
+
SELECT id INTO v_component_id FROM dashboard_component WHERE slug = 'total-menus';
|
|
73
|
+
IF v_component_id IS NOT NULL THEN
|
|
74
|
+
UPDATE dashboard_component_locale
|
|
75
|
+
SET description = 'Displays the total number of menu items available to users'
|
|
76
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_en_id;
|
|
77
|
+
|
|
78
|
+
IF v_locale_pt_id IS NOT NULL THEN
|
|
79
|
+
UPDATE dashboard_component_locale
|
|
80
|
+
SET description = 'Exibe o total de itens de menu disponíveis para os usuários'
|
|
81
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_pt_id;
|
|
82
|
+
END IF;
|
|
83
|
+
END IF;
|
|
84
|
+
|
|
85
|
+
-- Total Routes component
|
|
86
|
+
SELECT id INTO v_component_id FROM dashboard_component WHERE slug = 'total-routes';
|
|
87
|
+
IF v_component_id IS NOT NULL THEN
|
|
88
|
+
UPDATE dashboard_component_locale
|
|
89
|
+
SET description = 'Shows the total number of routes registered in the application'
|
|
90
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_en_id;
|
|
91
|
+
|
|
92
|
+
IF v_locale_pt_id IS NOT NULL THEN
|
|
93
|
+
UPDATE dashboard_component_locale
|
|
94
|
+
SET description = 'Mostra o total de rotas registradas na aplicação'
|
|
95
|
+
WHERE dashboard_component_id = v_component_id AND locale_id = v_locale_pt_id;
|
|
96
|
+
END IF;
|
|
97
|
+
END IF;
|
|
98
|
+
|
|
99
|
+
END $$;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Migration to add metadata fields to dashboard_component table
|
|
2
|
+
-- Run this SQL in your database
|
|
3
|
+
|
|
4
|
+
-- Add metadata columns to dashboard_component table
|
|
5
|
+
ALTER TABLE dashboard_component ADD COLUMN IF NOT EXISTS icon VARCHAR(255);
|
|
6
|
+
ALTER TABLE dashboard_component ADD COLUMN IF NOT EXISTS stat_key VARCHAR(255);
|
|
7
|
+
ALTER TABLE dashboard_component ADD COLUMN IF NOT EXISTS color VARCHAR(50);
|
|
8
|
+
|
|
9
|
+
-- Update existing widgets with metadata
|
|
10
|
+
UPDATE dashboard_component SET icon = 'IconUsers', stat_key = 'totalUsers' WHERE slug = 'total-users';
|
|
11
|
+
UPDATE dashboard_component SET icon = 'IconUserPlus', stat_key = 'recentUsers' WHERE slug = 'recent-users';
|
|
12
|
+
UPDATE dashboard_component SET icon = 'IconUserCheck', stat_key = 'activeUsers' WHERE slug = 'active-users';
|
|
13
|
+
UPDATE dashboard_component SET icon = 'IconShield', stat_key = 'totalRoles' WHERE slug = 'total-roles';
|
|
14
|
+
UPDATE dashboard_component SET icon = 'IconMenu2', stat_key = 'totalMenus' WHERE slug = 'total-menus';
|
|
15
|
+
UPDATE dashboard_component SET icon = 'IconRoute', stat_key = 'totalRoutes' WHERE slug = 'total-routes';
|
|
16
|
+
UPDATE dashboard_component SET icon = ' IconInfoCircle', stat_key = NULL WHERE slug = 'system-info';
|
|
17
|
+
UPDATE dashboard_component SET icon = 'IconPackage', stat_key = 'totalModules' WHERE slug = 'module-installed';
|
|
18
|
+
|
|
19
|
+
-- Optional: Add more widget examples
|
|
20
|
+
-- UPDATE dashboard_component SET icon = 'IconSettings', stat_key = 'totalSettings', color = 'primary' WHERE slug = 'total-settings';
|
|
21
|
+
-- UPDATE dashboard_component SET icon = 'IconAddressBook', stat_key = 'totalContacts', color = 'secondary' WHERE slug = 'total-contacts';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
-- Fix: Add stat_key, icon and color columns to dashboard_component table
|
|
2
|
+
-- This ensures all widgets have proper stat_key to display values
|
|
3
|
+
|
|
4
|
+
-- Step 1: Add columns if they don't exist
|
|
5
|
+
ALTER TABLE dashboard_component
|
|
6
|
+
ADD COLUMN IF NOT EXISTS stat_key VARCHAR(255),
|
|
7
|
+
ADD COLUMN IF NOT EXISTS icon VARCHAR(255),
|
|
8
|
+
ADD COLUMN IF NOT EXISTS color VARCHAR(50);
|
|
9
|
+
|
|
10
|
+
-- Step 2: Update existing widgets with proper values
|
|
11
|
+
|
|
12
|
+
-- Total Users Widget
|
|
13
|
+
UPDATE dashboard_component
|
|
14
|
+
SET
|
|
15
|
+
stat_key = 'totalUsers',
|
|
16
|
+
icon = COALESCE(icon, 'IconUsers'),
|
|
17
|
+
color = COALESCE(color, '#3b82f6')
|
|
18
|
+
WHERE slug = 'total-users';
|
|
19
|
+
|
|
20
|
+
-- Recent Users Widget
|
|
21
|
+
UPDATE dashboard_component
|
|
22
|
+
SET
|
|
23
|
+
stat_key = 'recentUsers',
|
|
24
|
+
icon = COALESCE(icon, 'IconUserPlus'),
|
|
25
|
+
color = COALESCE(color, '#10b981')
|
|
26
|
+
WHERE slug = 'recent-users';
|
|
27
|
+
|
|
28
|
+
-- Active Users Widget
|
|
29
|
+
UPDATE dashboard_component
|
|
30
|
+
SET
|
|
31
|
+
stat_key = 'activeUsers',
|
|
32
|
+
icon = COALESCE(icon, 'IconUserCheck'),
|
|
33
|
+
color = COALESCE(color, '#8b5cf6')
|
|
34
|
+
WHERE slug = 'active-users';
|
|
35
|
+
|
|
36
|
+
-- Total Roles Widget
|
|
37
|
+
UPDATE dashboard_component
|
|
38
|
+
SET
|
|
39
|
+
stat_key = 'totalRoles',
|
|
40
|
+
icon = COALESCE(icon, 'IconShield'),
|
|
41
|
+
color = COALESCE(color, '#f59e0b')
|
|
42
|
+
WHERE slug = 'total-roles';
|
|
43
|
+
|
|
44
|
+
-- Total Menus Widget
|
|
45
|
+
UPDATE dashboard_component
|
|
46
|
+
SET
|
|
47
|
+
stat_key = 'totalMenus',
|
|
48
|
+
icon = COALESCE(icon, 'IconMenu2'),
|
|
49
|
+
color = COALESCE(color, '#ec4899')
|
|
50
|
+
WHERE slug = 'total-menus';
|
|
51
|
+
|
|
52
|
+
-- Total Routes Widget
|
|
53
|
+
UPDATE dashboard_component
|
|
54
|
+
SET
|
|
55
|
+
stat_key = 'totalRoutes',
|
|
56
|
+
icon = COALESCE(icon, 'IconRoute'),
|
|
57
|
+
color = COALESCE(color, '#06b6d4')
|
|
58
|
+
WHERE slug = 'total-routes';
|
|
59
|
+
|
|
60
|
+
-- System Info / Modules Widget
|
|
61
|
+
UPDATE dashboard_component
|
|
62
|
+
SET
|
|
63
|
+
stat_key = 'totalModules',
|
|
64
|
+
icon = COALESCE(icon, 'IconPackage'),
|
|
65
|
+
color = COALESCE(color, '#6366f1')
|
|
66
|
+
WHERE slug = 'system-info';
|
|
67
|
+
|
|
68
|
+
-- Module Installed / Settings Widget
|
|
69
|
+
UPDATE dashboard_component
|
|
70
|
+
SET
|
|
71
|
+
stat_key = 'totalSettings',
|
|
72
|
+
icon = COALESCE(icon, 'IconSettings'),
|
|
73
|
+
color = COALESCE(color, '#64748b')
|
|
74
|
+
WHERE slug = 'module-installed';
|
|
75
|
+
|
|
76
|
+
-- Contacts Widget (if exists)
|
|
77
|
+
UPDATE dashboard_component
|
|
78
|
+
SET
|
|
79
|
+
stat_key = 'totalContacts',
|
|
80
|
+
icon = COALESCE(icon, 'IconAddressBook'),
|
|
81
|
+
color = COALESCE(color, '#f97316')
|
|
82
|
+
WHERE slug = 'total-contacts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hed-hog/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.166",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"sharp": "^0.34.2",
|
|
30
30
|
"speakeasy": "^2.0.0",
|
|
31
31
|
"uuid": "^11.1.0",
|
|
32
|
-
"@hed-hog/api-locale": "0.0.11",
|
|
33
32
|
"@hed-hog/api-prisma": "0.0.4",
|
|
33
|
+
"@hed-hog/api-locale": "0.0.11",
|
|
34
34
|
"@hed-hog/api": "0.0.3",
|
|
35
|
-
"@hed-hog/api-
|
|
35
|
+
"@hed-hog/api-mail": "0.0.7",
|
|
36
36
|
"@hed-hog/types": "0.0.1",
|
|
37
|
-
"@hed-hog/api-
|
|
37
|
+
"@hed-hog/api-pagination": "0.0.5"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|
|
@@ -22,8 +22,8 @@ export class DashboardController {
|
|
|
22
22
|
constructor(private readonly dashboardService: DashboardService) {}
|
|
23
23
|
|
|
24
24
|
@Get()
|
|
25
|
-
getAllDashboards(@Pagination() paginationParams
|
|
26
|
-
return this.dashboardService.getAllDashboards(paginationParams
|
|
25
|
+
getAllDashboards(@Pagination() paginationParams) {
|
|
26
|
+
return this.dashboardService.getAllDashboards(paginationParams);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
@Get(':id')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getLocaleText
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
2
|
import { PaginationService } from '@hed-hog/api-pagination';
|
|
3
3
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
4
|
import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common';
|
|
@@ -11,10 +11,27 @@ export class DashboardService {
|
|
|
11
11
|
private readonly prismaService: PrismaService,
|
|
12
12
|
@Inject(forwardRef(() => PaginationService))
|
|
13
13
|
private readonly paginationService: PaginationService,
|
|
14
|
-
@Inject(forwardRef(() => LocaleService))
|
|
15
|
-
private readonly localeService: LocaleService,
|
|
16
14
|
) {}
|
|
17
|
-
async getAllDashboards(paginationParams
|
|
15
|
+
async getAllDashboards(paginationParams) {
|
|
16
|
+
const fields = ['slug']
|
|
17
|
+
const OR = this.prismaService.createInsensitiveSearch(
|
|
18
|
+
fields,
|
|
19
|
+
paginationParams,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (paginationParams.search) {
|
|
23
|
+
OR.push({
|
|
24
|
+
dashboard_locale: {
|
|
25
|
+
some: {
|
|
26
|
+
name: {
|
|
27
|
+
contains: paginationParams.search,
|
|
28
|
+
mode: 'insensitive',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
18
35
|
return this.paginationService.paginate(
|
|
19
36
|
this.prismaService.dashboard,
|
|
20
37
|
paginationParams,
|
|
@@ -26,6 +43,9 @@ export class DashboardService {
|
|
|
26
43
|
},
|
|
27
44
|
},
|
|
28
45
|
},
|
|
46
|
+
where: {
|
|
47
|
+
OR
|
|
48
|
+
},
|
|
29
49
|
orderBy: {
|
|
30
50
|
id: 'desc',
|
|
31
51
|
},
|
|
@@ -75,7 +95,6 @@ export class DashboardService {
|
|
|
75
95
|
},
|
|
76
96
|
});
|
|
77
97
|
|
|
78
|
-
// Criar locales se fornecidos
|
|
79
98
|
if (data.locale) {
|
|
80
99
|
for (const [localeCode, localeData] of Object.entries(data.locale)) {
|
|
81
100
|
const localeRecord = await this.prismaService.locale.findFirst({
|
|
@@ -105,14 +124,11 @@ export class DashboardService {
|
|
|
105
124
|
},
|
|
106
125
|
});
|
|
107
126
|
|
|
108
|
-
// Atualizar locales se fornecidos
|
|
109
127
|
if (data.locale) {
|
|
110
|
-
// Remove locales existentes
|
|
111
128
|
await this.prismaService.dashboard_locale.deleteMany({
|
|
112
129
|
where: { dashboard_id: id },
|
|
113
130
|
});
|
|
114
|
-
|
|
115
|
-
// Criar novos locales
|
|
131
|
+
|
|
116
132
|
for (const [localeCode, localeData] of Object.entries(data.locale)) {
|
|
117
133
|
const localeRecord = await this.prismaService.locale.findFirst({
|
|
118
134
|
where: { code: localeCode },
|
|
@@ -13,9 +13,6 @@ import {
|
|
|
13
13
|
} from './dto';
|
|
14
14
|
@Injectable()
|
|
15
15
|
export class DashboardComponentService {
|
|
16
|
-
private readonly modelName = 'dashboard_component';
|
|
17
|
-
private readonly foreignKey = 'component_id';
|
|
18
|
-
|
|
19
16
|
constructor(
|
|
20
17
|
@Inject(forwardRef(() => PrismaService))
|
|
21
18
|
private readonly prismaService: PrismaService,
|
|
@@ -24,6 +21,25 @@ export class DashboardComponentService {
|
|
|
24
21
|
) {}
|
|
25
22
|
|
|
26
23
|
async getAllComponents(paginationParams) {
|
|
24
|
+
const fields = ['slug']
|
|
25
|
+
const OR = this.prismaService.createInsensitiveSearch(
|
|
26
|
+
fields,
|
|
27
|
+
paginationParams,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (paginationParams.search) {
|
|
31
|
+
OR.push({
|
|
32
|
+
dashboard_component_locale: {
|
|
33
|
+
some: {
|
|
34
|
+
name: {
|
|
35
|
+
contains: paginationParams.search,
|
|
36
|
+
mode: 'insensitive',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
return this.paginationService.paginate(
|
|
28
44
|
this.prismaService.dashboard_component,
|
|
29
45
|
paginationParams,
|
|
@@ -35,6 +51,9 @@ export class DashboardComponentService {
|
|
|
35
51
|
},
|
|
36
52
|
},
|
|
37
53
|
},
|
|
54
|
+
where: {
|
|
55
|
+
OR
|
|
56
|
+
},
|
|
38
57
|
orderBy: {
|
|
39
58
|
created_at: 'desc',
|
|
40
59
|
},
|
|
@@ -76,6 +95,9 @@ export class DashboardComponentService {
|
|
|
76
95
|
width: data.width,
|
|
77
96
|
height: data.height,
|
|
78
97
|
is_resizable: data.is_resizable ?? true,
|
|
98
|
+
stat_key: data.stat_key || null,
|
|
99
|
+
icon: data.icon || null,
|
|
100
|
+
color: data.color || null,
|
|
79
101
|
},
|
|
80
102
|
});
|
|
81
103
|
|
|
@@ -91,6 +113,7 @@ export class DashboardComponentService {
|
|
|
91
113
|
dashboard_component_id: component.id,
|
|
92
114
|
locale_id: localeRecord.id,
|
|
93
115
|
name: localeData.name,
|
|
116
|
+
description: localeData.description || null,
|
|
94
117
|
},
|
|
95
118
|
});
|
|
96
119
|
}
|
|
@@ -113,6 +136,9 @@ export class DashboardComponentService {
|
|
|
113
136
|
width: data.width,
|
|
114
137
|
height: data.height,
|
|
115
138
|
is_resizable: data.is_resizable,
|
|
139
|
+
stat_key: data.stat_key,
|
|
140
|
+
icon: data.icon,
|
|
141
|
+
color: data.color,
|
|
116
142
|
},
|
|
117
143
|
});
|
|
118
144
|
|
|
@@ -132,6 +158,7 @@ export class DashboardComponentService {
|
|
|
132
158
|
dashboard_component_id: id,
|
|
133
159
|
locale_id: localeRecord.id,
|
|
134
160
|
name: localeData.name,
|
|
161
|
+
description: localeData.description || null,
|
|
135
162
|
},
|
|
136
163
|
});
|
|
137
164
|
}
|
|
@@ -34,6 +34,18 @@ export class CreateDTO {
|
|
|
34
34
|
@IsBoolean({ message: (args) => getLocaleText('validation.booleanRequired', args.value) })
|
|
35
35
|
is_resizable?: boolean;
|
|
36
36
|
|
|
37
|
+
@IsOptional()
|
|
38
|
+
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
39
|
+
stat_key?: string;
|
|
40
|
+
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
43
|
+
icon?: string;
|
|
44
|
+
|
|
45
|
+
@IsOptional()
|
|
46
|
+
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
47
|
+
color?: string;
|
|
48
|
+
|
|
37
49
|
@IsObject({
|
|
38
50
|
message: (args) =>
|
|
39
51
|
getLocaleText('validation.localeMustBeObject', args.value),
|
|
@@ -41,5 +53,5 @@ export class CreateDTO {
|
|
|
41
53
|
@IsNotEmpty({
|
|
42
54
|
message: (args) => getLocaleText('validation.localeRequired', args.value),
|
|
43
55
|
})
|
|
44
|
-
locale: Record<string, { name: string }>;
|
|
56
|
+
locale: Record<string, { name: string; description?: string }>;
|
|
45
57
|
}
|
|
@@ -38,6 +38,18 @@ export class UpdateDTO {
|
|
|
38
38
|
@IsBoolean({ message: (args) => getLocaleText('validation.booleanRequired', args.value) })
|
|
39
39
|
is_resizable?: boolean;
|
|
40
40
|
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
43
|
+
stat_key?: string;
|
|
44
|
+
|
|
45
|
+
@IsOptional()
|
|
46
|
+
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
47
|
+
icon?: string;
|
|
48
|
+
|
|
49
|
+
@IsOptional()
|
|
50
|
+
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
51
|
+
color?: string;
|
|
52
|
+
|
|
41
53
|
@IsOptional()
|
|
42
54
|
@IsObject({
|
|
43
55
|
message: (args) =>
|
|
@@ -46,5 +58,5 @@ export class UpdateDTO {
|
|
|
46
58
|
@IsNotEmpty({
|
|
47
59
|
message: (args) => getLocaleText('validation.localeRequired', args.value),
|
|
48
60
|
})
|
|
49
|
-
locale?: Record<string, { name: string }>;
|
|
61
|
+
locale?: Record<string, { name: string; description?: string }>;
|
|
50
62
|
}
|
|
@@ -24,8 +24,8 @@ export class DashboardCoreController {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@Get('layout/:slug')
|
|
27
|
-
getUserLayout(@User() user, @Param('slug') slug: string) {
|
|
28
|
-
return this.dashboardCoreService.getUserLayout(user.id, slug);
|
|
27
|
+
getUserLayout(@User() user, @Param('slug') slug: string, @Locale() locale: string) {
|
|
28
|
+
return this.dashboardCoreService.getUserLayout(user.id, slug, locale);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@Post('layout/:slug')
|
|
@@ -42,11 +42,13 @@ export class DashboardCoreController {
|
|
|
42
42
|
@User() user,
|
|
43
43
|
@Param('slug') slug: string,
|
|
44
44
|
@Body() body: { componentSlug: string },
|
|
45
|
+
@Locale() locale: string,
|
|
45
46
|
) {
|
|
46
47
|
return this.dashboardCoreService.addWidgetToUserDashboard(
|
|
47
48
|
user.id,
|
|
48
49
|
slug,
|
|
49
50
|
body.componentSlug,
|
|
51
|
+
locale,
|
|
50
52
|
);
|
|
51
53
|
}
|
|
52
54
|
|