@hed-hog/core 0.0.151 → 0.0.152
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 +214 -9
- package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.js +35 -35
- package/dist/dashboard/dashboard/dashboard.controller.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.module.d.ts +1 -1
- package/dist/dashboard/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.module.js +11 -6
- package/dist/dashboard/dashboard/dashboard.module.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.d.ts +217 -16
- package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.js +115 -28
- package/dist/dashboard/dashboard/dashboard.service.js.map +1 -1
- package/dist/dashboard/dashboard/dto/create.dto.d.ts +4 -2
- package/dist/dashboard/dashboard/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dto/create.dto.js +10 -1
- package/dist/dashboard/dashboard/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard/dto/index.d.ts +5 -0
- package/dist/dashboard/dashboard/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dto/index.js +25 -0
- package/dist/dashboard/dashboard/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard/dto/update.dto.d.ts +5 -4
- package/dist/dashboard/dashboard/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dto/update.dto.js +27 -3
- package/dist/dashboard/dashboard/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +114 -9
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js +35 -36
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.module.js +4 -3
- package/dist/dashboard/dashboard-component/dashboard-component.module.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +116 -15
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +109 -22
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +4 -2
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js +10 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/index.d.ts +5 -0
- package/dist/dashboard/dashboard-component/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dto/index.js +25 -0
- package/dist/dashboard/dashboard-component/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +13 -4
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.js +67 -3
- package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +56 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +65 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +52 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +221 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +26 -29
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.controller.js +24 -43
- package/dist/dashboard/dashboard-item/dashboard-item.controller.js.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +30 -34
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.service.js +51 -35
- package/dist/dashboard/dashboard-item/dashboard-item.service.js.map +1 -1
- package/dist/dashboard/dashboard-item/dto/index.d.ts +5 -0
- package/dist/dashboard/dashboard-item/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dto/index.js +25 -0
- package/dist/dashboard/dashboard-item/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard-item/dto/update.dto.d.ts +7 -4
- package/dist/dashboard/dashboard-item/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dto/update.dto.js +42 -3
- package/dist/dashboard/dashboard-item/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard.module.js +1 -1
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/hedhog/data/route.yaml +44 -14
- package/hedhog/query/dashboard-seed.sql +131 -0
- package/package.json +1 -1
- package/src/dashboard/dashboard/dashboard.controller.ts +26 -23
- package/src/dashboard/dashboard/dashboard.module.ts +7 -2
- package/src/dashboard/dashboard/dashboard.service.ts +125 -44
- package/src/dashboard/dashboard/dto/create.dto.ts +12 -3
- package/src/dashboard/dashboard/dto/index.ts +7 -0
- package/src/dashboard/dashboard/dto/update.dto.ts +17 -3
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +22 -19
- package/src/dashboard/dashboard-component/dashboard-component.module.ts +3 -3
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +128 -39
- package/src/dashboard/dashboard-component/dto/create.dto.ts +12 -3
- package/src/dashboard/dashboard-component/dto/index.ts +7 -0
- package/src/dashboard/dashboard-component/dto/update.dto.ts +49 -3
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +53 -2
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +271 -0
- package/src/dashboard/dashboard-item/dashboard-item.controller.ts +17 -26
- package/src/dashboard/dashboard-item/dashboard-item.service.ts +55 -47
- package/src/dashboard/dashboard-item/dto/index.ts +7 -0
- package/src/dashboard/dashboard-item/dto/update.dto.ts +27 -3
- package/src/dashboard/dashboard.module.ts +2 -2
- package/src/language/en.json +4 -1
- package/src/language/pt.json +4 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LocaleService } from '@hed-hog/api-locale';
|
|
2
|
+
import { PaginationService } from '@hed-hog/api-pagination';
|
|
3
3
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
|
-
import {
|
|
5
|
-
import { UpdateDTO } from './dto/update.dto';
|
|
4
|
+
import { CreateDashboardItemDTO } from './dto';
|
|
6
5
|
export declare class DashboardItemService {
|
|
7
6
|
private readonly prismaService;
|
|
8
7
|
private readonly paginationService;
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
private readonly localeService;
|
|
9
|
+
constructor(prismaService: PrismaService, paginationService: PaginationService, localeService: LocaleService);
|
|
10
|
+
getAllDashboardItems(paginationParams: any, locale: string, dashboardId?: number): Promise<{
|
|
11
11
|
total: any;
|
|
12
12
|
lastPage: number;
|
|
13
13
|
page: number;
|
|
@@ -16,7 +16,28 @@ export declare class DashboardItemService {
|
|
|
16
16
|
next: number;
|
|
17
17
|
data: any[];
|
|
18
18
|
}>;
|
|
19
|
-
|
|
19
|
+
createDashboardItem(data: CreateDashboardItemDTO, locale: string): Promise<{
|
|
20
|
+
dashboard: {
|
|
21
|
+
id: number;
|
|
22
|
+
created_at: Date;
|
|
23
|
+
updated_at: Date;
|
|
24
|
+
slug: string;
|
|
25
|
+
};
|
|
26
|
+
dashboard_component: {
|
|
27
|
+
path: string;
|
|
28
|
+
width: number;
|
|
29
|
+
id: number;
|
|
30
|
+
created_at: Date;
|
|
31
|
+
updated_at: Date;
|
|
32
|
+
slug: string;
|
|
33
|
+
min_width: number;
|
|
34
|
+
max_width: number | null;
|
|
35
|
+
min_height: number;
|
|
36
|
+
max_height: number | null;
|
|
37
|
+
height: number;
|
|
38
|
+
is_resizable: boolean;
|
|
39
|
+
};
|
|
40
|
+
} & {
|
|
20
41
|
width: number;
|
|
21
42
|
id: number;
|
|
22
43
|
created_at: Date;
|
|
@@ -27,33 +48,8 @@ export declare class DashboardItemService {
|
|
|
27
48
|
x_axis: number;
|
|
28
49
|
y_axis: number;
|
|
29
50
|
}>;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
id: number;
|
|
33
|
-
created_at: Date;
|
|
34
|
-
updated_at: Date;
|
|
35
|
-
height: number;
|
|
36
|
-
component_id: number;
|
|
37
|
-
dashboard_id: number;
|
|
38
|
-
x_axis: number;
|
|
39
|
-
y_axis: number;
|
|
40
|
-
}>;
|
|
41
|
-
update({ id, data }: {
|
|
42
|
-
id: number;
|
|
43
|
-
data: UpdateDTO;
|
|
44
|
-
}): Promise<{
|
|
45
|
-
width: number;
|
|
46
|
-
id: number;
|
|
47
|
-
created_at: Date;
|
|
48
|
-
updated_at: Date;
|
|
49
|
-
height: number;
|
|
50
|
-
component_id: number;
|
|
51
|
-
dashboard_id: number;
|
|
52
|
-
x_axis: number;
|
|
53
|
-
y_axis: number;
|
|
54
|
-
}>;
|
|
55
|
-
delete({ ids }: DeleteDTO): Promise<{
|
|
56
|
-
count: number;
|
|
51
|
+
deleteDashboardItem(id: number, locale: string): Promise<{
|
|
52
|
+
success: boolean;
|
|
57
53
|
}>;
|
|
58
54
|
}
|
|
59
55
|
//# sourceMappingURL=dashboard-item.service.d.ts.map
|
|
@@ -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,
|
|
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"}
|
|
@@ -13,57 +13,71 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.DashboardItemService = void 0;
|
|
16
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
16
17
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
17
18
|
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
18
19
|
const common_1 = require("@nestjs/common");
|
|
19
20
|
let DashboardItemService = class DashboardItemService {
|
|
20
|
-
constructor(prismaService, paginationService) {
|
|
21
|
+
constructor(prismaService, paginationService, localeService) {
|
|
21
22
|
this.prismaService = prismaService;
|
|
22
23
|
this.paginationService = paginationService;
|
|
24
|
+
this.localeService = localeService;
|
|
23
25
|
}
|
|
24
|
-
async
|
|
25
|
-
const fields = [];
|
|
26
|
-
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
|
27
|
-
if (paginationParams.search && !isNaN(+paginationParams.search)) {
|
|
28
|
-
OR.push({ id: { equals: +paginationParams.search } });
|
|
29
|
-
}
|
|
26
|
+
async getAllDashboardItems(paginationParams, locale, dashboardId) {
|
|
30
27
|
return this.paginationService.paginate(this.prismaService.dashboard_item, paginationParams, {
|
|
31
|
-
where: {
|
|
32
|
-
OR,
|
|
33
|
-
},
|
|
28
|
+
where: dashboardId ? { dashboard_id: dashboardId } : undefined,
|
|
34
29
|
include: {
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
dashboard: {
|
|
31
|
+
include: {
|
|
32
|
+
dashboard_locale: {
|
|
33
|
+
include: {
|
|
34
|
+
locale: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
dashboard_component: {
|
|
40
|
+
include: {
|
|
41
|
+
dashboard_component_locale: {
|
|
42
|
+
include: {
|
|
43
|
+
locale: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
37
48
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
where: { id: id },
|
|
43
|
-
});
|
|
49
|
+
orderBy: {
|
|
50
|
+
id: 'desc',
|
|
51
|
+
},
|
|
52
|
+
}, 'dashboardItem');
|
|
44
53
|
}
|
|
45
|
-
async
|
|
54
|
+
async createDashboardItem(data, locale) {
|
|
46
55
|
return this.prismaService.dashboard_item.create({
|
|
47
|
-
data
|
|
56
|
+
data: {
|
|
57
|
+
dashboard_id: data.dashboard_id,
|
|
58
|
+
component_id: data.component_id,
|
|
59
|
+
width: data.width,
|
|
60
|
+
height: data.height,
|
|
61
|
+
x_axis: data.x_axis,
|
|
62
|
+
y_axis: data.y_axis,
|
|
63
|
+
},
|
|
64
|
+
include: {
|
|
65
|
+
dashboard: true,
|
|
66
|
+
dashboard_component: true,
|
|
67
|
+
},
|
|
48
68
|
});
|
|
49
69
|
}
|
|
50
|
-
async
|
|
51
|
-
|
|
52
|
-
where: { id
|
|
53
|
-
data,
|
|
70
|
+
async deleteDashboardItem(id, locale) {
|
|
71
|
+
const item = await this.prismaService.dashboard_item.findUnique({
|
|
72
|
+
where: { id },
|
|
54
73
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (ids == undefined || ids == null) {
|
|
58
|
-
throw new common_1.BadRequestException('You must select at least one item to delete.');
|
|
74
|
+
if (!item) {
|
|
75
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('dashboardItemNotFound', locale, 'Dashboard item not found'));
|
|
59
76
|
}
|
|
60
|
-
|
|
61
|
-
where: {
|
|
62
|
-
id: {
|
|
63
|
-
in: ids,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
77
|
+
await this.prismaService.dashboard_item.delete({
|
|
78
|
+
where: { id },
|
|
66
79
|
});
|
|
80
|
+
return { success: true };
|
|
67
81
|
}
|
|
68
82
|
};
|
|
69
83
|
exports.DashboardItemService = DashboardItemService;
|
|
@@ -71,7 +85,9 @@ exports.DashboardItemService = DashboardItemService = __decorate([
|
|
|
71
85
|
(0, common_1.Injectable)(),
|
|
72
86
|
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_prisma_1.PrismaService))),
|
|
73
87
|
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_pagination_1.PaginationService))),
|
|
88
|
+
__param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_locale_1.LocaleService))),
|
|
74
89
|
__metadata("design:paramtypes", [api_prisma_1.PrismaService,
|
|
75
|
-
api_pagination_1.PaginationService
|
|
90
|
+
api_pagination_1.PaginationService,
|
|
91
|
+
api_locale_1.LocaleService])
|
|
76
92
|
], DashboardItemService);
|
|
77
93
|
//# sourceMappingURL=dashboard-item.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-item.service.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-item/dashboard-item.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"dashboard-item.service.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-item/dashboard-item.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAmE;AACnE,4DAA4D;AAC5D,oDAAoD;AACpD,2CAKwB;AAIjB,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAEmB,aAA4B,EAE5B,iBAAoC,EAEpC,aAA4B;QAJ5B,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QAEpC,kBAAa,GAAb,aAAa,CAAe;IAC5C,CAAC;IAEJ,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,MAAc,EAAE,WAAoB;QAC/E,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,cAAc,EACjC,gBAAgB,EAChB;YACE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;YAC9D,OAAO,EAAE;gBACP,SAAS,EAAE;oBACT,OAAO,EAAE;wBACP,gBAAgB,EAAE;4BAChB,OAAO,EAAE;gCACP,MAAM,EAAE,IAAI;6BACb;yBACF;qBACF;iBACF;gBACD,mBAAmB,EAAE;oBACnB,OAAO,EAAE;wBACP,0BAA0B,EAAE;4BAC1B,OAAO,EAAE;gCACP,MAAM,EAAE,IAAI;6BACb;yBACF;qBACF;iBACF;aACF;YACD,OAAO,EAAE;gBACP,EAAE,EAAE,MAAM;aACX;SACF,EACD,eAAe,CAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,IAA4B,EAAE,MAAc;QACpE,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC;YAC9C,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;YACD,OAAO,EAAE;gBACP,SAAS,EAAE,IAAI;gBACf,mBAAmB,EAAE,IAAI;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,EAAU,EAAE,MAAc;QAClD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,UAAU,CAAC;YAC9D,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,0BAAiB,CACzB,IAAA,0BAAa,EAAC,uBAAuB,EAAE,MAAM,EAAE,0BAA0B,CAAC,CAC3E,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC;YAC7C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAA;AA7EY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kCAAiB,CAAC,CAAC,CAAA;IAE3C,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;qCAHR,0BAAa;QAET,kCAAiB;QAErB,0BAAa;GAPpC,oBAAoB,CA6EhC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.UpdateDashboardItemDTO = exports.CreateDashboardItemDTO = void 0;
|
|
18
|
+
__exportStar(require("./create.dto"), exports);
|
|
19
|
+
__exportStar(require("./update.dto"), exports);
|
|
20
|
+
// Aliases para compatibilidade
|
|
21
|
+
var create_dto_1 = require("./create.dto");
|
|
22
|
+
Object.defineProperty(exports, "CreateDashboardItemDTO", { enumerable: true, get: function () { return create_dto_1.CreateDTO; } });
|
|
23
|
+
var update_dto_1 = require("./update.dto");
|
|
24
|
+
Object.defineProperty(exports, "UpdateDashboardItemDTO", { enumerable: true, get: function () { return update_dto_1.UpdateDTO; } });
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare class UpdateDTO {
|
|
2
|
+
component_id?: number;
|
|
3
|
+
dashboard_id?: number;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
x_axis?: number;
|
|
7
|
+
y_axis?: number;
|
|
4
8
|
}
|
|
5
|
-
export {};
|
|
6
9
|
//# sourceMappingURL=update.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/update.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/update.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAGpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1,9 +1,48 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.UpdateDTO = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
class UpdateDTO
|
|
13
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class UpdateDTO {
|
|
7
16
|
}
|
|
8
17
|
exports.UpdateDTO = UpdateDTO;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsOptional)(),
|
|
20
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
21
|
+
__metadata("design:type", Number)
|
|
22
|
+
], UpdateDTO.prototype, "component_id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], UpdateDTO.prototype, "dashboard_id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
|
30
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
31
|
+
__metadata("design:type", Number)
|
|
32
|
+
], UpdateDTO.prototype, "width", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], UpdateDTO.prototype, "height", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], UpdateDTO.prototype, "x_axis", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsOptional)(),
|
|
45
|
+
(0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
|
|
46
|
+
__metadata("design:type", Number)
|
|
47
|
+
], UpdateDTO.prototype, "y_axis", void 0);
|
|
9
48
|
//# sourceMappingURL=update.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/update.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-item/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,qDAAuD;AAEvD,MAAa,SAAS;CAwBrB;AAxBD,8BAwBC;AArBC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;+CACtE;AAItB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;+CACtE;AAItB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;wCAC7E;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;yCAC5E;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;yCAC5E;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;yCAC5E"}
|
|
@@ -23,7 +23,7 @@ exports.DashboardModule = DashboardModule = __decorate([
|
|
|
23
23
|
imports: [
|
|
24
24
|
(0, common_1.forwardRef)(() => api_locale_1.LocaleModule),
|
|
25
25
|
(0, common_1.forwardRef)(() => api_prisma_1.PrismaModule),
|
|
26
|
-
(0, common_1.forwardRef)(() => dashboard_module_1.
|
|
26
|
+
(0, common_1.forwardRef)(() => dashboard_module_1.DashboardCrudModule),
|
|
27
27
|
(0, common_1.forwardRef)(() => dashboard_component_module_1.DashboardComponentModule),
|
|
28
28
|
(0, common_1.forwardRef)(() => dashboard_item_module_1.DashboardItemModule),
|
|
29
29
|
(0, common_1.forwardRef)(() => dashboard_user_module_1.DashboardUserModule),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.module.js","sourceRoot":"","sources":["../../src/dashboard/dashboard.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAmD;AACnD,oDAAmD;AACnD,2CAAoD;AACpD,iGAA4F;AAC5F,kFAA6E;AAC7E,kFAA6E;AAC7E,kFAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"dashboard.module.js","sourceRoot":"","sources":["../../src/dashboard/dashboard.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAmD;AACnD,oDAAmD;AACnD,2CAAoD;AACpD,iGAA4F;AAC5F,kFAA6E;AAC7E,kFAA6E;AAC7E,kFAA6E;AAC7E,mEAAmE;AAgB5D,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAd3B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sCAAmB,CAAC;YACrC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qDAAwB,CAAC;YAC1C,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC;YACrC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC;YACrC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC;SACtC;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,eAAe,CAAG"}
|
package/hedhog/data/route.yaml
CHANGED
|
@@ -614,6 +614,48 @@
|
|
|
614
614
|
role:
|
|
615
615
|
- where:
|
|
616
616
|
slug: admin
|
|
617
|
+
- url: /dashboard-core/:slug
|
|
618
|
+
method: GET
|
|
619
|
+
relations:
|
|
620
|
+
role:
|
|
621
|
+
- where:
|
|
622
|
+
slug: admin
|
|
623
|
+
- url: /dashboard-core/stats/overview
|
|
624
|
+
method: GET
|
|
625
|
+
relations:
|
|
626
|
+
role:
|
|
627
|
+
- where:
|
|
628
|
+
slug: admin
|
|
629
|
+
- url: /dashboard-core/stats/user-growth
|
|
630
|
+
method: GET
|
|
631
|
+
relations:
|
|
632
|
+
role:
|
|
633
|
+
- where:
|
|
634
|
+
slug: admin
|
|
635
|
+
- url: /dashboard-core/layout/:slug
|
|
636
|
+
method: GET
|
|
637
|
+
relations:
|
|
638
|
+
role:
|
|
639
|
+
- where:
|
|
640
|
+
slug: admin
|
|
641
|
+
- url: /dashboard-core/layout/:slug
|
|
642
|
+
method: POST
|
|
643
|
+
relations:
|
|
644
|
+
role:
|
|
645
|
+
- where:
|
|
646
|
+
slug: admin
|
|
647
|
+
- url: /dashboard-core/widget/:slug
|
|
648
|
+
method: POST
|
|
649
|
+
relations:
|
|
650
|
+
role:
|
|
651
|
+
- where:
|
|
652
|
+
slug: admin
|
|
653
|
+
- url: /dashboard-core/widget/:slug/:widgetId
|
|
654
|
+
method: DELETE
|
|
655
|
+
relations:
|
|
656
|
+
role:
|
|
657
|
+
- where:
|
|
658
|
+
slug: admin
|
|
617
659
|
- url: /dashboard
|
|
618
660
|
method: GET
|
|
619
661
|
relations:
|
|
@@ -638,7 +680,7 @@
|
|
|
638
680
|
role:
|
|
639
681
|
- where:
|
|
640
682
|
slug: admin
|
|
641
|
-
- url: /dashboard
|
|
683
|
+
- url: /dashboard/:id
|
|
642
684
|
method: DELETE
|
|
643
685
|
relations:
|
|
644
686
|
role:
|
|
@@ -668,7 +710,7 @@
|
|
|
668
710
|
role:
|
|
669
711
|
- where:
|
|
670
712
|
slug: admin
|
|
671
|
-
- url: /dashboard-component
|
|
713
|
+
- url: /dashboard-component/:id
|
|
672
714
|
method: DELETE
|
|
673
715
|
relations:
|
|
674
716
|
role:
|
|
@@ -687,18 +729,6 @@
|
|
|
687
729
|
- where:
|
|
688
730
|
slug: admin
|
|
689
731
|
- url: /dashboard-item/:id
|
|
690
|
-
method: GET
|
|
691
|
-
relations:
|
|
692
|
-
role:
|
|
693
|
-
- where:
|
|
694
|
-
slug: admin
|
|
695
|
-
- url: /dashboard-item/:id
|
|
696
|
-
method: PATCH
|
|
697
|
-
relations:
|
|
698
|
-
role:
|
|
699
|
-
- where:
|
|
700
|
-
slug: admin
|
|
701
|
-
- url: /dashboard-item
|
|
702
732
|
method: DELETE
|
|
703
733
|
relations:
|
|
704
734
|
role:
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
-- Dashboard Seed Script (Versão Simplificada)
|
|
2
|
+
-- Este script cria os dados iniciais para o sistema de dashboard
|
|
3
|
+
|
|
4
|
+
-- Primeiro, criar o dashboard principal
|
|
5
|
+
INSERT INTO dashboard (slug, created_at, updated_at)
|
|
6
|
+
VALUES ('admin-dashboard', NOW(), NOW())
|
|
7
|
+
ON CONFLICT (slug) DO NOTHING;
|
|
8
|
+
|
|
9
|
+
-- Criar locales do dashboard
|
|
10
|
+
DO $$
|
|
11
|
+
DECLARE
|
|
12
|
+
v_dashboard_id INT;
|
|
13
|
+
v_locale_en_id INT;
|
|
14
|
+
v_locale_pt_id INT;
|
|
15
|
+
BEGIN
|
|
16
|
+
SELECT id INTO v_dashboard_id FROM dashboard WHERE slug = 'admin-dashboard';
|
|
17
|
+
SELECT id INTO v_locale_en_id FROM locale WHERE code = 'en' LIMIT 1;
|
|
18
|
+
SELECT id INTO v_locale_pt_id FROM locale WHERE code = 'pt' LIMIT 1;
|
|
19
|
+
|
|
20
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_locale WHERE dashboard_id = v_dashboard_id AND locale_id = v_locale_en_id) THEN
|
|
21
|
+
INSERT INTO dashboard_locale (locale_id, dashboard_id, name, created_at, updated_at)
|
|
22
|
+
VALUES (v_locale_en_id, v_dashboard_id, 'Admin Dashboard', NOW(), NOW());
|
|
23
|
+
END IF;
|
|
24
|
+
|
|
25
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_locale WHERE dashboard_id = v_dashboard_id AND locale_id = v_locale_pt_id) THEN
|
|
26
|
+
INSERT INTO dashboard_locale (locale_id, dashboard_id, name, created_at, updated_at)
|
|
27
|
+
VALUES (v_locale_pt_id, v_dashboard_id, 'Dashboard Admin', NOW(), NOW());
|
|
28
|
+
END IF;
|
|
29
|
+
END $$;
|
|
30
|
+
|
|
31
|
+
-- Criar componentes de dashboard
|
|
32
|
+
DO $$
|
|
33
|
+
DECLARE
|
|
34
|
+
v_locale_en_id INT;
|
|
35
|
+
v_locale_pt_id INT;
|
|
36
|
+
v_component_id INT;
|
|
37
|
+
BEGIN
|
|
38
|
+
SELECT id INTO v_locale_en_id FROM locale WHERE code = 'en' LIMIT 1;
|
|
39
|
+
SELECT id INTO v_locale_pt_id FROM locale WHERE code = 'pt' LIMIT 1;
|
|
40
|
+
|
|
41
|
+
-- Componente: Total de Usuários
|
|
42
|
+
INSERT INTO dashboard_component (slug, path, min_width, max_width, min_height, max_height, width, height, is_resizable, created_at, updated_at)
|
|
43
|
+
VALUES ('total-users', '/widgets/total-users', 2, 6, 1, 2, 3, 2, true, NOW(), NOW())
|
|
44
|
+
ON CONFLICT (slug) DO UPDATE SET updated_at = NOW()
|
|
45
|
+
RETURNING id INTO v_component_id;
|
|
46
|
+
|
|
47
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_en_id AND dashboard_component_id = v_component_id) THEN
|
|
48
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
49
|
+
VALUES (v_locale_en_id, v_component_id, 'Total Users', NOW(), NOW());
|
|
50
|
+
END IF;
|
|
51
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_pt_id AND dashboard_component_id = v_component_id) THEN
|
|
52
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
53
|
+
VALUES (v_locale_pt_id, v_component_id, 'Total de Usuários', NOW(), NOW());
|
|
54
|
+
END IF;
|
|
55
|
+
|
|
56
|
+
-- Componente: Usuários Recentes
|
|
57
|
+
INSERT INTO dashboard_component (slug, path, min_width, max_width, min_height, max_height, width, height, is_resizable, created_at, updated_at)
|
|
58
|
+
VALUES ('recent-users', '/widgets/recent-users', 2, 6, 1, 2, 3, 2, true, NOW(), NOW())
|
|
59
|
+
ON CONFLICT (slug) DO UPDATE SET updated_at = NOW()
|
|
60
|
+
RETURNING id INTO v_component_id;
|
|
61
|
+
|
|
62
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_en_id AND dashboard_component_id = v_component_id) THEN
|
|
63
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
64
|
+
VALUES (v_locale_en_id, v_component_id, 'Recent Users', NOW(), NOW());
|
|
65
|
+
END IF;
|
|
66
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_pt_id AND dashboard_component_id = v_component_id) THEN
|
|
67
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
68
|
+
VALUES (v_locale_pt_id, v_component_id, 'Usuários Recentes', NOW(), NOW());
|
|
69
|
+
END IF;
|
|
70
|
+
|
|
71
|
+
-- Componente: Usuários Ativos
|
|
72
|
+
INSERT INTO dashboard_component (slug, path, min_width, max_width, min_height, max_height, width, height, is_resizable, created_at, updated_at)
|
|
73
|
+
VALUES ('active-users', '/widgets/active-users', 2, 6, 1, 2, 3, 2, true, NOW(), NOW())
|
|
74
|
+
ON CONFLICT (slug) DO UPDATE SET updated_at = NOW()
|
|
75
|
+
RETURNING id INTO v_component_id;
|
|
76
|
+
|
|
77
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_en_id AND dashboard_component_id = v_component_id) THEN
|
|
78
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
79
|
+
VALUES (v_locale_en_id, v_component_id, 'Active Users', NOW(), NOW());
|
|
80
|
+
END IF;
|
|
81
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_pt_id AND dashboard_component_id = v_component_id) THEN
|
|
82
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
83
|
+
VALUES (v_locale_pt_id, v_component_id, 'Usuários Ativos', NOW(), NOW());
|
|
84
|
+
END IF;
|
|
85
|
+
|
|
86
|
+
-- Componente: Total de Roles
|
|
87
|
+
INSERT INTO dashboard_component (slug, path, min_width, max_width, min_height, max_height, width, height, is_resizable, created_at, updated_at)
|
|
88
|
+
VALUES ('total-roles', '/widgets/total-roles', 2, 6, 1, 2, 3, 2, true, NOW(), NOW())
|
|
89
|
+
ON CONFLICT (slug) DO UPDATE SET updated_at = NOW()
|
|
90
|
+
RETURNING id INTO v_component_id;
|
|
91
|
+
|
|
92
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_en_id AND dashboard_component_id = v_component_id) THEN
|
|
93
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
94
|
+
VALUES (v_locale_en_id, v_component_id, 'Total Roles', NOW(), NOW());
|
|
95
|
+
END IF;
|
|
96
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_pt_id AND dashboard_component_id = v_component_id) THEN
|
|
97
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
98
|
+
VALUES (v_locale_pt_id, v_component_id, 'Total de Perfis', NOW(), NOW());
|
|
99
|
+
END IF;
|
|
100
|
+
|
|
101
|
+
-- Componente: Total de Menus
|
|
102
|
+
INSERT INTO dashboard_component (slug, path, min_width, max_width, min_height, max_height, width, height, is_resizable, created_at, updated_at)
|
|
103
|
+
VALUES ('total-menus', '/widgets/total-menus', 2, 6, 1, 2, 3, 2, true, NOW(), NOW())
|
|
104
|
+
ON CONFLICT (slug) DO UPDATE SET updated_at = NOW()
|
|
105
|
+
RETURNING id INTO v_component_id;
|
|
106
|
+
|
|
107
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_en_id AND dashboard_component_id = v_component_id) THEN
|
|
108
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
109
|
+
VALUES (v_locale_en_id, v_component_id, 'Total Menus', NOW(), NOW());
|
|
110
|
+
END IF;
|
|
111
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_pt_id AND dashboard_component_id = v_component_id) THEN
|
|
112
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
113
|
+
VALUES (v_locale_pt_id, v_component_id, 'Total de Menus', NOW(), NOW());
|
|
114
|
+
END IF;
|
|
115
|
+
|
|
116
|
+
-- Componente: Total de Rotas
|
|
117
|
+
INSERT INTO dashboard_component (slug, path, min_width, max_width, min_height, max_height, width, height, is_resizable, created_at, updated_at)
|
|
118
|
+
VALUES ('total-routes', '/widgets/total-routes', 2, 6, 1, 2, 3, 2, true, NOW(), NOW())
|
|
119
|
+
ON CONFLICT (slug) DO UPDATE SET updated_at = NOW()
|
|
120
|
+
RETURNING id INTO v_component_id;
|
|
121
|
+
|
|
122
|
+
IF NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_en_id AND dashboard_component_id = v_component_id) THEN
|
|
123
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
124
|
+
VALUES (v_locale_en_id, v_component_id, 'Total Routes', NOW(), NOW());
|
|
125
|
+
END IF;
|
|
126
|
+
IF v_locale_pt_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM dashboard_component_locale WHERE locale_id = v_locale_pt_id AND dashboard_component_id = v_component_id) THEN
|
|
127
|
+
INSERT INTO dashboard_component_locale (locale_id, dashboard_component_id, name, created_at, updated_at)
|
|
128
|
+
VALUES (v_locale_pt_id, v_component_id, 'Total de Rotas', NOW(), NOW());
|
|
129
|
+
END IF;
|
|
130
|
+
|
|
131
|
+
END $$;
|