@hed-hog/core 0.0.170 → 0.0.172
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-component/dashboard-component.controller.d.ts +70 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js +13 -3
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +70 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +33 -4
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +122 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.js +83 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.js.map +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.module.d.ts +3 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.module.js +26 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.module.js.map +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +125 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.js +143 -0
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.js.map +1 -0
- package/dist/dashboard/dashboard-component-role/dto/create.dto.d.ts +5 -0
- package/dist/dashboard/dashboard-component-role/dto/create.dto.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component-role/dto/create.dto.js +25 -0
- package/dist/dashboard/dashboard-component-role/dto/create.dto.js.map +1 -0
- package/dist/dashboard/dashboard-component-role/dto/index.d.ts +2 -0
- package/dist/dashboard/dashboard-component-role/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component-role/dto/index.js +18 -0
- package/dist/dashboard/dashboard-component-role/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +15 -9
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +13 -4
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +16 -9
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +52 -38
- package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
- package/dist/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard.module.js +2 -0
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/hedhog/data/role.yaml +14 -0
- package/hedhog/data/route.yaml +34 -4
- package/package.json +4 -4
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +7 -2
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +44 -4
- package/src/dashboard/dashboard-component-role/dashboard-component-role.controller.ts +57 -0
- package/src/dashboard/dashboard-component-role/dashboard-component-role.module.ts +13 -0
- package/src/dashboard/dashboard-component-role/dashboard-component-role.service.ts +170 -0
- package/src/dashboard/dashboard-component-role/dto/create.dto.ts +9 -0
- package/src/dashboard/dashboard-component-role/dto/index.ts +1 -0
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +8 -3
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +61 -46
- package/src/dashboard/dashboard.module.ts +2 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { PaginationService } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import { CreateDashboardComponentRoleDTO } from './dto';
|
|
4
|
+
export declare class DashboardComponentRoleService {
|
|
5
|
+
private readonly prismaService;
|
|
6
|
+
private readonly paginationService;
|
|
7
|
+
constructor(prismaService: PrismaService, paginationService: PaginationService);
|
|
8
|
+
getAll(paginationParams: any, locale: string): Promise<{
|
|
9
|
+
total: any;
|
|
10
|
+
lastPage: number;
|
|
11
|
+
page: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
prev: number;
|
|
14
|
+
next: number;
|
|
15
|
+
data: any[];
|
|
16
|
+
}>;
|
|
17
|
+
getAllByComponent(componentId: number, locale: string): Promise<({
|
|
18
|
+
role: {
|
|
19
|
+
role_locale: ({
|
|
20
|
+
locale: {
|
|
21
|
+
code: string;
|
|
22
|
+
name: string;
|
|
23
|
+
region: string;
|
|
24
|
+
id: number;
|
|
25
|
+
created_at: Date;
|
|
26
|
+
updated_at: Date;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
};
|
|
29
|
+
} & {
|
|
30
|
+
name: string;
|
|
31
|
+
id: number;
|
|
32
|
+
description: string | null;
|
|
33
|
+
created_at: Date;
|
|
34
|
+
updated_at: Date;
|
|
35
|
+
locale_id: number;
|
|
36
|
+
role_id: number;
|
|
37
|
+
})[];
|
|
38
|
+
} & {
|
|
39
|
+
id: number;
|
|
40
|
+
created_at: Date;
|
|
41
|
+
updated_at: Date;
|
|
42
|
+
slug: string;
|
|
43
|
+
};
|
|
44
|
+
} & {
|
|
45
|
+
id: number;
|
|
46
|
+
created_at: Date;
|
|
47
|
+
updated_at: Date;
|
|
48
|
+
component_id: number;
|
|
49
|
+
role_id: number;
|
|
50
|
+
})[]>;
|
|
51
|
+
create(data: CreateDashboardComponentRoleDTO, locale: string): Promise<{
|
|
52
|
+
dashboard_component: {
|
|
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;
|
|
67
|
+
created_at: Date;
|
|
68
|
+
updated_at: Date;
|
|
69
|
+
locale_id: number;
|
|
70
|
+
dashboard_component_id: number;
|
|
71
|
+
})[];
|
|
72
|
+
} & {
|
|
73
|
+
width: number;
|
|
74
|
+
id: number;
|
|
75
|
+
created_at: Date;
|
|
76
|
+
updated_at: Date;
|
|
77
|
+
slug: string;
|
|
78
|
+
min_width: number;
|
|
79
|
+
max_width: number | null;
|
|
80
|
+
min_height: number;
|
|
81
|
+
max_height: number | null;
|
|
82
|
+
height: number;
|
|
83
|
+
is_resizable: boolean;
|
|
84
|
+
};
|
|
85
|
+
role: {
|
|
86
|
+
role_locale: ({
|
|
87
|
+
locale: {
|
|
88
|
+
code: string;
|
|
89
|
+
name: string;
|
|
90
|
+
region: string;
|
|
91
|
+
id: number;
|
|
92
|
+
created_at: Date;
|
|
93
|
+
updated_at: Date;
|
|
94
|
+
enabled: boolean;
|
|
95
|
+
};
|
|
96
|
+
} & {
|
|
97
|
+
name: string;
|
|
98
|
+
id: number;
|
|
99
|
+
description: string | null;
|
|
100
|
+
created_at: Date;
|
|
101
|
+
updated_at: Date;
|
|
102
|
+
locale_id: number;
|
|
103
|
+
role_id: number;
|
|
104
|
+
})[];
|
|
105
|
+
} & {
|
|
106
|
+
id: number;
|
|
107
|
+
created_at: Date;
|
|
108
|
+
updated_at: Date;
|
|
109
|
+
slug: string;
|
|
110
|
+
};
|
|
111
|
+
} & {
|
|
112
|
+
id: number;
|
|
113
|
+
created_at: Date;
|
|
114
|
+
updated_at: Date;
|
|
115
|
+
component_id: number;
|
|
116
|
+
role_id: number;
|
|
117
|
+
}>;
|
|
118
|
+
delete(id: number, locale: string): Promise<{
|
|
119
|
+
success: boolean;
|
|
120
|
+
}>;
|
|
121
|
+
deleteByComponentAndRole(componentId: number, roleId: number, locale: string): Promise<{
|
|
122
|
+
success: boolean;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=dashboard-component-role.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-component-role.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component-role/dashboard-component-role.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,+BAA+B,EAAE,MAAM,OAAO,CAAC;AAExD,qBACa,6BAA6B;IAGtC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,MAAM,CAAC,gBAAgB,KAAA,EAAE,MAAM,EAAE,MAAM;;;;;;;;;IAiCvC,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmBrD,MAAM,CAAC,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+C5D,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;IAsBjC,wBAAwB,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM;;;CAyBjB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DashboardComponentRoleService = void 0;
|
|
16
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
17
|
+
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
18
|
+
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
19
|
+
const common_1 = require("@nestjs/common");
|
|
20
|
+
let DashboardComponentRoleService = class DashboardComponentRoleService {
|
|
21
|
+
constructor(prismaService, paginationService) {
|
|
22
|
+
this.prismaService = prismaService;
|
|
23
|
+
this.paginationService = paginationService;
|
|
24
|
+
}
|
|
25
|
+
async getAll(paginationParams, locale) {
|
|
26
|
+
return this.paginationService.paginate(this.prismaService.dashboard_component_role, paginationParams, {
|
|
27
|
+
include: {
|
|
28
|
+
dashboard_component: {
|
|
29
|
+
include: {
|
|
30
|
+
dashboard_component_locale: {
|
|
31
|
+
include: {
|
|
32
|
+
locale: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
role: {
|
|
38
|
+
include: {
|
|
39
|
+
role_locale: {
|
|
40
|
+
include: {
|
|
41
|
+
locale: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
orderBy: {
|
|
48
|
+
id: 'desc',
|
|
49
|
+
},
|
|
50
|
+
}, 'dashboardComponentRole');
|
|
51
|
+
}
|
|
52
|
+
async getAllByComponent(componentId, locale) {
|
|
53
|
+
const relations = await this.prismaService.dashboard_component_role.findMany({
|
|
54
|
+
where: { component_id: componentId },
|
|
55
|
+
include: {
|
|
56
|
+
role: {
|
|
57
|
+
include: {
|
|
58
|
+
role_locale: {
|
|
59
|
+
include: {
|
|
60
|
+
locale: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return relations;
|
|
68
|
+
}
|
|
69
|
+
async create(data, locale) {
|
|
70
|
+
// Verificar se a relação já existe
|
|
71
|
+
const existing = await this.prismaService.dashboard_component_role.findFirst({
|
|
72
|
+
where: {
|
|
73
|
+
component_id: data.component_id,
|
|
74
|
+
role_id: data.role_id,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (existing) {
|
|
78
|
+
throw new Error((0, api_locale_1.getLocaleText)('dashboardComponentRoleAlreadyExists', locale, 'Dashboard component role already exists'));
|
|
79
|
+
}
|
|
80
|
+
return this.prismaService.dashboard_component_role.create({
|
|
81
|
+
data: {
|
|
82
|
+
component_id: data.component_id,
|
|
83
|
+
role_id: data.role_id,
|
|
84
|
+
},
|
|
85
|
+
include: {
|
|
86
|
+
dashboard_component: {
|
|
87
|
+
include: {
|
|
88
|
+
dashboard_component_locale: {
|
|
89
|
+
include: {
|
|
90
|
+
locale: true,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
role: {
|
|
96
|
+
include: {
|
|
97
|
+
role_locale: {
|
|
98
|
+
include: {
|
|
99
|
+
locale: true,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async delete(id, locale) {
|
|
108
|
+
const relation = await this.prismaService.dashboard_component_role.findUnique({
|
|
109
|
+
where: { id },
|
|
110
|
+
});
|
|
111
|
+
if (!relation) {
|
|
112
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('dashboardComponentRoleNotFound', locale, 'Dashboard component role not found'));
|
|
113
|
+
}
|
|
114
|
+
await this.prismaService.dashboard_component_role.delete({
|
|
115
|
+
where: { id },
|
|
116
|
+
});
|
|
117
|
+
return { success: true };
|
|
118
|
+
}
|
|
119
|
+
async deleteByComponentAndRole(componentId, roleId, locale) {
|
|
120
|
+
const relation = await this.prismaService.dashboard_component_role.findFirst({
|
|
121
|
+
where: {
|
|
122
|
+
component_id: componentId,
|
|
123
|
+
role_id: roleId,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
if (!relation) {
|
|
127
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('dashboardComponentRoleNotFound', locale, 'Dashboard component role not found'));
|
|
128
|
+
}
|
|
129
|
+
await this.prismaService.dashboard_component_role.delete({
|
|
130
|
+
where: { id: relation.id },
|
|
131
|
+
});
|
|
132
|
+
return { success: true };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.DashboardComponentRoleService = DashboardComponentRoleService;
|
|
136
|
+
exports.DashboardComponentRoleService = DashboardComponentRoleService = __decorate([
|
|
137
|
+
(0, common_1.Injectable)(),
|
|
138
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_prisma_1.PrismaService))),
|
|
139
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_pagination_1.PaginationService))),
|
|
140
|
+
__metadata("design:paramtypes", [api_prisma_1.PrismaService,
|
|
141
|
+
api_pagination_1.PaginationService])
|
|
142
|
+
], DashboardComponentRoleService);
|
|
143
|
+
//# sourceMappingURL=dashboard-component-role.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-component-role.service.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-component-role/dashboard-component-role.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoD;AACpD,4DAA4D;AAC5D,oDAAoD;AACpD,2CAKwB;AAIjB,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACxC,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAc;QAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,wBAAwB,EAC3C,gBAAgB,EAChB;YACE,OAAO,EAAE;gBACP,mBAAmB,EAAE;oBACnB,OAAO,EAAE;wBACP,0BAA0B,EAAE;4BAC1B,OAAO,EAAE;gCACP,MAAM,EAAE,IAAI;6BACb;yBACF;qBACF;iBACF;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE;wBACP,WAAW,EAAE;4BACX,OAAO,EAAE;gCACP,MAAM,EAAE,IAAI;6BACb;yBACF;qBACF;iBACF;aACF;YACD,OAAO,EAAE;gBACP,EAAE,EAAE,MAAM;aACX;SACF,EACD,wBAAwB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,WAAmB,EAAE,MAAc;QACzD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,QAAQ,CAAC;YAC3E,KAAK,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE;YACpC,OAAO,EAAE;gBACP,IAAI,EAAE;oBACJ,OAAO,EAAE;wBACP,WAAW,EAAE;4BACX,OAAO,EAAE;gCACP,MAAM,EAAE,IAAI;6BACb;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;QAEH,OAA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MAAM,CAAC;IAGrB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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.CreateDashboardComponentRoleDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class CreateDashboardComponentRoleDTO {
|
|
15
|
+
}
|
|
16
|
+
exports.CreateDashboardComponentRoleDTO = CreateDashboardComponentRoleDTO;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsInt)(),
|
|
19
|
+
__metadata("design:type", Number)
|
|
20
|
+
], CreateDashboardComponentRoleDTO.prototype, "component_id", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsInt)(),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], CreateDashboardComponentRoleDTO.prototype, "role_id", void 0);
|
|
25
|
+
//# sourceMappingURL=create.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-component-role/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwC;AAExC,MAAa,+BAA+B;CAM3C;AAND,0EAMC;AAJC;IADC,IAAA,uBAAK,GAAE;;qEACa;AAGrB;IADC,IAAA,uBAAK,GAAE;;gEACQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-component-role/dto/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./create.dto"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dashboard/dashboard-component-role/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
|
@@ -48,7 +48,7 @@ export declare class DashboardCoreController {
|
|
|
48
48
|
x_axis: number;
|
|
49
49
|
y_axis: number;
|
|
50
50
|
})[]>;
|
|
51
|
-
|
|
51
|
+
getUserStatistics(): Promise<{
|
|
52
52
|
cards: {
|
|
53
53
|
sessionsToday: {
|
|
54
54
|
value: number;
|
|
@@ -58,20 +58,12 @@ export declare class DashboardCoreController {
|
|
|
58
58
|
value: number;
|
|
59
59
|
change: number;
|
|
60
60
|
};
|
|
61
|
-
emailsSent: {
|
|
62
|
-
value: number;
|
|
63
|
-
change: number;
|
|
64
|
-
};
|
|
65
61
|
roles: {
|
|
66
62
|
value: number;
|
|
67
63
|
change: number;
|
|
68
64
|
};
|
|
69
65
|
};
|
|
70
66
|
charts: {
|
|
71
|
-
emailsPerWeek: {
|
|
72
|
-
day: string;
|
|
73
|
-
sent: number;
|
|
74
|
-
}[];
|
|
75
67
|
permissionDistribution: {
|
|
76
68
|
name: string;
|
|
77
69
|
value: number;
|
|
@@ -85,6 +77,20 @@ export declare class DashboardCoreController {
|
|
|
85
77
|
}[];
|
|
86
78
|
};
|
|
87
79
|
}>;
|
|
80
|
+
getMailStatistics(): Promise<{
|
|
81
|
+
cards: {
|
|
82
|
+
emailsSent: {
|
|
83
|
+
value: number;
|
|
84
|
+
change: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
charts: {
|
|
88
|
+
emailsPerWeek: {
|
|
89
|
+
day: string;
|
|
90
|
+
sent: number;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
}>;
|
|
88
94
|
getUserLayout(user: any, slug: string, locale: string): Promise<{
|
|
89
95
|
i: string;
|
|
90
96
|
component_id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-core.controller.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-core/dashboard-core.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,qBAEa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB;IAGvE,QAAQ,CAAgB,IAAI,EAAE,MAAM,EAAY,MAAM,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKtD,
|
|
1
|
+
{"version":3,"file":"dashboard-core.controller.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-core/dashboard-core.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,qBAEa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB;IAGvE,QAAQ,CAAgB,IAAI,EAAE,MAAM,EAAY,MAAM,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKtD,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKjB,iBAAiB;;;;;;;;;;;;;;IAKjB,aAAa,CAAS,IAAI,KAAA,EAAiB,IAAI,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;IAKjF,cAAc,CACJ,IAAI,KAAA,EACG,IAAI,EAAE,MAAM,EACnB,IAAI,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;;;IAM5F,SAAS,CACC,IAAI,KAAA,EACG,IAAI,EAAE,MAAM,EACnB,IAAI,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,EAC7B,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;IAW1B,YAAY,CACF,IAAI,KAAA,EACG,IAAI,EAAE,MAAM,EACR,QAAQ,EAAE,MAAM;;;CAQtC"}
|
|
@@ -24,8 +24,11 @@ let DashboardCoreController = class DashboardCoreController {
|
|
|
24
24
|
fromSlug(slug, locale) {
|
|
25
25
|
return this.dashboardCoreService.fromSlug(slug, locale);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
return this.dashboardCoreService.
|
|
27
|
+
getUserStatistics() {
|
|
28
|
+
return this.dashboardCoreService.getUserStatistics();
|
|
29
|
+
}
|
|
30
|
+
getMailStatistics() {
|
|
31
|
+
return this.dashboardCoreService.getMailStatistics();
|
|
29
32
|
}
|
|
30
33
|
getUserLayout(user, slug, locale) {
|
|
31
34
|
return this.dashboardCoreService.getUserLayout(user.id, slug, locale);
|
|
@@ -50,11 +53,17 @@ __decorate([
|
|
|
50
53
|
__metadata("design:returntype", void 0)
|
|
51
54
|
], DashboardCoreController.prototype, "fromSlug", null);
|
|
52
55
|
__decorate([
|
|
53
|
-
(0, common_1.Get)('stats/overview'),
|
|
56
|
+
(0, common_1.Get)('stats/overview/users'),
|
|
57
|
+
__metadata("design:type", Function),
|
|
58
|
+
__metadata("design:paramtypes", []),
|
|
59
|
+
__metadata("design:returntype", void 0)
|
|
60
|
+
], DashboardCoreController.prototype, "getUserStatistics", null);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, common_1.Get)('stats/overview/mails'),
|
|
54
63
|
__metadata("design:type", Function),
|
|
55
64
|
__metadata("design:paramtypes", []),
|
|
56
65
|
__metadata("design:returntype", void 0)
|
|
57
|
-
], DashboardCoreController.prototype, "
|
|
66
|
+
], DashboardCoreController.prototype, "getMailStatistics", null);
|
|
58
67
|
__decorate([
|
|
59
68
|
(0, common_1.Get)('layout/:slug'),
|
|
60
69
|
__param(0, (0, api_1.User)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-core.controller.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-core/dashboard-core.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA0C;AAC1C,oDAA6C;AAC7C,2CAA4E;AAC5E,qEAAgE;AAIzD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,YAA6B,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAG3E,QAAQ,CAAgB,IAAY,EAAY,MAAM;QACpD,OAAO,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;IAGD,
|
|
1
|
+
{"version":3,"file":"dashboard-core.controller.js","sourceRoot":"","sources":["../../../src/dashboard/dashboard-core/dashboard-core.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA0C;AAC1C,oDAA6C;AAC7C,2CAA4E;AAC5E,qEAAgE;AAIzD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,YAA6B,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAG3E,QAAQ,CAAgB,IAAY,EAAY,MAAM;QACpD,OAAO,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;IAGD,iBAAiB;QACf,OAAO,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;IACvD,CAAC;IAGD,iBAAiB;QACf,OAAO,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;IACvD,CAAC;IAGD,aAAa,CAAS,IAAI,EAAiB,IAAY,EAAY,MAAc;QAC/E,OAAO,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IAGD,cAAc,CACJ,IAAI,EACG,IAAY,EACnB,IAAkF;QAE1F,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9E,CAAC;IAGD,SAAS,CACC,IAAI,EACG,IAAY,EACnB,IAA+B,EAC7B,MA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AA,cAAK,EAAC,MAAM,CAAC,CAAA;IACb,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;;;;2DAOnB;kCA1DU,uBAAuB;IAFnC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,gBAAgB,CAAC;qCAEwB,6CAAoB;GAD5D,uBAAuB,CA2DnC"}
|
|
@@ -48,7 +48,8 @@ export declare class DashboardCoreService {
|
|
|
48
48
|
x_axis: number;
|
|
49
49
|
y_axis: number;
|
|
50
50
|
})[]>;
|
|
51
|
-
|
|
51
|
+
calculateChange(current: number, previous: number): number;
|
|
52
|
+
getUserStatistics(): Promise<{
|
|
52
53
|
cards: {
|
|
53
54
|
sessionsToday: {
|
|
54
55
|
value: number;
|
|
@@ -58,20 +59,12 @@ export declare class DashboardCoreService {
|
|
|
58
59
|
value: number;
|
|
59
60
|
change: number;
|
|
60
61
|
};
|
|
61
|
-
emailsSent: {
|
|
62
|
-
value: number;
|
|
63
|
-
change: number;
|
|
64
|
-
};
|
|
65
62
|
roles: {
|
|
66
63
|
value: number;
|
|
67
64
|
change: number;
|
|
68
65
|
};
|
|
69
66
|
};
|
|
70
67
|
charts: {
|
|
71
|
-
emailsPerWeek: {
|
|
72
|
-
day: string;
|
|
73
|
-
sent: number;
|
|
74
|
-
}[];
|
|
75
68
|
permissionDistribution: {
|
|
76
69
|
name: string;
|
|
77
70
|
value: number;
|
|
@@ -85,6 +78,20 @@ export declare class DashboardCoreService {
|
|
|
85
78
|
}[];
|
|
86
79
|
};
|
|
87
80
|
}>;
|
|
81
|
+
getMailStatistics(): Promise<{
|
|
82
|
+
cards: {
|
|
83
|
+
emailsSent: {
|
|
84
|
+
value: number;
|
|
85
|
+
change: number;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
charts: {
|
|
89
|
+
emailsPerWeek: {
|
|
90
|
+
day: string;
|
|
91
|
+
sent: number;
|
|
92
|
+
}[];
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
88
95
|
getUserLayout(userId: number, slug: string, localeCode: string): Promise<{
|
|
89
96
|
i: string;
|
|
90
97
|
component_id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-core.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-core/dashboard-core.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,qBACa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEnD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"dashboard-core.service.d.ts","sourceRoot":"","sources":["../../../src/dashboard/dashboard-core/dashboard-core.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,qBACa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEnD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoBzC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK3C,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0HjB,iBAAiB;;;;;;;;;;;;;;IAoDjB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;IA6D9D,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,KAAK,CAAC;QACZ,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;;;IA4DE,wBAAwB,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;IA6Gd,6BAA6B,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM;;;CAYnB"}
|
|
@@ -35,55 +35,33 @@ let DashboardCoreService = class DashboardCoreService {
|
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
calculateChange(current, previous) {
|
|
39
|
+
if (previous === 0)
|
|
40
|
+
return current === 0 ? 0 : 100;
|
|
41
|
+
return Number((((current - previous) / previous) * 100).toFixed(1));
|
|
42
|
+
}
|
|
43
|
+
;
|
|
44
|
+
async getUserStatistics() {
|
|
39
45
|
const now = new Date();
|
|
40
46
|
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
41
|
-
const sevenDaysAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
|
|
42
47
|
const twelveMonthsAgo = new Date(now.getFullYear() - 1, now.getMonth(), 1);
|
|
43
48
|
const currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
44
49
|
const lastMonthStart = new Date(now.getFullYear(), now.getMonth() - 1, 1);
|
|
45
50
|
const lastMonthEnd = new Date(now.getFullYear(), now.getMonth(), 0, 23, 59, 59);
|
|
46
|
-
const [sessionsTodayCount, activeUsersCount,
|
|
51
|
+
const [sessionsTodayCount, activeUsersCount, rolesCount, sessionsCurrentMonth, usersCurrentMonth, rolesCurrentMonth, sessionsLastMonth, usersLastMonth, rolesLastMonth,] = await Promise.all([
|
|
47
52
|
this.prismaService.user_session.count({ where: { created_at: { gte: todayStart } } }),
|
|
48
53
|
this.prismaService.user.count(),
|
|
49
|
-
this.prismaService.mail_sent.count(),
|
|
50
54
|
this.prismaService.role.count(),
|
|
51
55
|
this.prismaService.user_session.count({ where: { created_at: { gte: currentMonthStart } } }),
|
|
52
56
|
this.prismaService.user.count({ where: { created_at: { gte: currentMonthStart } } }),
|
|
53
|
-
this.prismaService.mail_sent.count({ where: { created_at: { gte: currentMonthStart } } }),
|
|
54
57
|
this.prismaService.role.count({ where: { created_at: { gte: currentMonthStart } } }),
|
|
55
58
|
this.prismaService.user_session.count({ where: { created_at: { gte: lastMonthStart, lte: lastMonthEnd } } }),
|
|
56
59
|
this.prismaService.user.count({ where: { created_at: { gte: lastMonthStart, lte: lastMonthEnd } } }),
|
|
57
|
-
this.prismaService.mail_sent.count({ where: { created_at: { gte: lastMonthStart, lte: lastMonthEnd } } }),
|
|
58
60
|
this.prismaService.role.count({ where: { created_at: { gte: lastMonthStart, lte: lastMonthEnd } } }),
|
|
59
61
|
]);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
return Number((((current - previous) / previous) * 100).toFixed(1));
|
|
65
|
-
};
|
|
66
|
-
const sessionsChange = calculateChange(sessionsCurrentMonth, sessionsLastMonth);
|
|
67
|
-
const usersChange = calculateChange(usersCurrentMonth, usersLastMonth);
|
|
68
|
-
const emailsChange = calculateChange(emailsCurrentMonth, emailsLastMonth);
|
|
69
|
-
const rolesChange = calculateChange(rolesCurrentMonth, rolesLastMonth);
|
|
70
|
-
const emailsPerWeek = await this.prismaService.$queryRaw `
|
|
71
|
-
SELECT
|
|
72
|
-
DATE("created_at") as day,
|
|
73
|
-
COUNT(*) as sent
|
|
74
|
-
FROM "mail_sent"
|
|
75
|
-
WHERE "created_at" >= ${sevenDaysAgo}
|
|
76
|
-
GROUP BY DATE("created_at")
|
|
77
|
-
ORDER BY day ASC
|
|
78
|
-
`;
|
|
79
|
-
const weekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
80
|
-
const emailWeekData = emailsPerWeek.map((item) => {
|
|
81
|
-
const dayOfWeek = new Date(item.day).getDay();
|
|
82
|
-
return {
|
|
83
|
-
day: weekDays[dayOfWeek],
|
|
84
|
-
sent: Number(item.sent),
|
|
85
|
-
};
|
|
86
|
-
});
|
|
62
|
+
const sessionsChange = this.calculateChange(sessionsCurrentMonth, sessionsLastMonth);
|
|
63
|
+
const usersChange = this.calculateChange(usersCurrentMonth, usersLastMonth);
|
|
64
|
+
const rolesChange = this.calculateChange(rolesCurrentMonth, rolesLastMonth);
|
|
87
65
|
const permissionDistribution = await this.prismaService.$queryRaw `
|
|
88
66
|
SELECT
|
|
89
67
|
r.slug as name,
|
|
@@ -148,23 +126,59 @@ let DashboardCoreService = class DashboardCoreService {
|
|
|
148
126
|
value: activeUsersCount,
|
|
149
127
|
change: usersChange,
|
|
150
128
|
},
|
|
151
|
-
emailsSent: {
|
|
152
|
-
value: emailsSentCount,
|
|
153
|
-
change: emailsChange,
|
|
154
|
-
},
|
|
155
129
|
roles: {
|
|
156
130
|
value: rolesCount,
|
|
157
131
|
change: rolesChange,
|
|
158
132
|
},
|
|
159
133
|
},
|
|
160
134
|
charts: {
|
|
161
|
-
emailsPerWeek: emailWeekData,
|
|
162
135
|
permissionDistribution: permissionsData,
|
|
163
136
|
sessionActivity: sessionActivityData,
|
|
164
137
|
userGrowth: userGrowthData,
|
|
165
138
|
},
|
|
166
139
|
};
|
|
167
140
|
}
|
|
141
|
+
async getMailStatistics() {
|
|
142
|
+
const now = new Date();
|
|
143
|
+
const currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
144
|
+
const lastMonthStart = new Date(now.getFullYear(), now.getMonth() - 1, 1);
|
|
145
|
+
const lastMonthEnd = new Date(now.getFullYear(), now.getMonth(), 0, 23, 59, 59);
|
|
146
|
+
const sevenDaysAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
|
|
147
|
+
const [emailsSentCount, emailsCurrentMonth, emailsLastMonth,] = await Promise.all([
|
|
148
|
+
this.prismaService.mail_sent.count(),
|
|
149
|
+
this.prismaService.mail_sent.count({ where: { created_at: { gte: currentMonthStart } } }),
|
|
150
|
+
this.prismaService.mail_sent.count({ where: { created_at: { gte: lastMonthStart, lte: lastMonthEnd } } }),
|
|
151
|
+
]);
|
|
152
|
+
const emailsChange = this.calculateChange(emailsCurrentMonth, emailsLastMonth);
|
|
153
|
+
const emailsPerWeek = await this.prismaService.$queryRaw `
|
|
154
|
+
SELECT
|
|
155
|
+
DATE("created_at") as day,
|
|
156
|
+
COUNT(*) as sent
|
|
157
|
+
FROM "mail_sent"
|
|
158
|
+
WHERE "created_at" >= ${sevenDaysAgo}
|
|
159
|
+
GROUP BY DATE("created_at")
|
|
160
|
+
ORDER BY day ASC
|
|
161
|
+
`;
|
|
162
|
+
const weekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
163
|
+
const emailWeekData = emailsPerWeek.map((item) => {
|
|
164
|
+
const dayOfWeek = new Date(item.day).getDay();
|
|
165
|
+
return {
|
|
166
|
+
day: weekDays[dayOfWeek],
|
|
167
|
+
sent: Number(item.sent),
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
cards: {
|
|
172
|
+
emailsSent: {
|
|
173
|
+
value: emailsSentCount,
|
|
174
|
+
change: emailsChange,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
charts: {
|
|
178
|
+
emailsPerWeek: emailWeekData,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
168
182
|
async getUserLayout(userId, slug, localeCode) {
|
|
169
183
|
const dashboard = await this.prismaService.dashboard.findFirst({ where: { slug } });
|
|
170
184
|
if (!dashboard) {
|