emilsoftware-utilities 1.3.111 → 1.3.113
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/ContractGenerator.js +2 -2
- package/dist/Logger.js +1 -0
- package/dist/accessi-module/AccessiModule.js +1 -2
- package/dist/accessi-module/Controllers/PermissionController.d.ts +1 -0
- package/dist/accessi-module/Controllers/PermissionController.js +24 -1
- package/dist/accessi-module/Dtos/GetGroupsWithMenusResponse.d.ts +11 -0
- package/dist/accessi-module/Dtos/GetGroupsWithMenusResponse.js +63 -0
- package/dist/accessi-module/Dtos/GetMenusResponse.d.ts +6 -3
- package/dist/accessi-module/Dtos/GetMenusResponse.js +29 -4
- package/dist/accessi-module/Services/EmailService/EmailService.js +1 -1
- package/dist/accessi-module/Services/PermissionService/PermissionService.d.ts +2 -0
- package/dist/accessi-module/Services/PermissionService/PermissionService.js +44 -0
- package/dist/accessi-module/index.js +3 -22
- package/dist/accessi-module/swagger/SwaggerConfig.js +8 -5
- package/dist/tests/contract/test.js +1 -1
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ class DocumentGenerator {
|
|
|
76
76
|
const absolutePath = path_1.default.resolve(fontPath);
|
|
77
77
|
const buffer = yield fs_1.promises.readFile(absolutePath);
|
|
78
78
|
const base64Font = buffer.toString('base64');
|
|
79
|
-
console.log(`Installing font ${fontName} from ${absolutePath}`);
|
|
79
|
+
//console.log(`Installing font ${fontName} from ${absolutePath}`);
|
|
80
80
|
this.doc.addFileToVFS(`${fontName}.ttf`, base64Font);
|
|
81
81
|
this.doc.addFont(`${fontName}.ttf`, fontName, 'normal');
|
|
82
82
|
this.doc.setFont(fontName);
|
|
@@ -227,7 +227,7 @@ class DocumentGenerator {
|
|
|
227
227
|
this.curY = this.config.margini.alto;
|
|
228
228
|
}
|
|
229
229
|
this.doc.addImage(base64Image, format, startX, this.curY, imgConf.dimensioni[0], imgConf.dimensioni[1]);
|
|
230
|
-
console.log(`Image inserted at X: ${startX}, Y: ${this.curY}`);
|
|
230
|
+
//console.log(`Image inserted at X: ${startX}, Y: ${this.curY}`);
|
|
231
231
|
this.curY = this.curY + imgConf.dimensioni[1] + this.config.staccoriga;
|
|
232
232
|
}
|
|
233
233
|
}
|
package/dist/Logger.js
CHANGED
|
@@ -9,7 +9,6 @@ var AccessiModule_1;
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AccessiModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
-
const AccessiController_1 = require("./Controllers/AccessiController");
|
|
13
12
|
const AuthService_1 = require("./Services/AuthService/AuthService");
|
|
14
13
|
const EmailService_1 = require("./Services/EmailService/EmailService");
|
|
15
14
|
const PermissionService_1 = require("./Services/PermissionService/PermissionService");
|
|
@@ -40,7 +39,7 @@ exports.AccessiModule = AccessiModule;
|
|
|
40
39
|
exports.AccessiModule = AccessiModule = AccessiModule_1 = __decorate([
|
|
41
40
|
(0, common_1.Global)(),
|
|
42
41
|
(0, common_1.Module)({
|
|
43
|
-
controllers: [
|
|
42
|
+
controllers: [EmailController_1.EmailController, AuthController_1.AuthController, PermissionController_1.PermissionController, UserController_1.UserController],
|
|
44
43
|
providers: [AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService],
|
|
45
44
|
exports: [AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService],
|
|
46
45
|
})
|
|
@@ -19,5 +19,6 @@ export declare class PermissionController {
|
|
|
19
19
|
assignPermissionsToUser(res: Response, codiceUtente: number, assignPermissionsRequest: AssignPermissionsToUserRequest): Promise<Response<any, Record<string, any>>>;
|
|
20
20
|
deleteRole(codiceRuolo: number, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
21
21
|
getMenus(res: Response): Promise<Response<any, Record<string, any>>>;
|
|
22
|
+
getGroupsWithMenus(res: Response): Promise<Response<any, Record<string, any>>>;
|
|
22
23
|
getUserRolesAndGrants(codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
23
24
|
}
|
|
@@ -33,6 +33,7 @@ const AssignPermissionsToUserRequest_1 = require("../Dtos/AssignPermissionsToUse
|
|
|
33
33
|
const GetMenusResponse_1 = require("../Dtos/GetMenusResponse");
|
|
34
34
|
const GetRolesResponse_1 = require("../Dtos/GetRolesResponse");
|
|
35
35
|
const UserGrantsDto_1 = require("../Dtos/UserGrantsDto");
|
|
36
|
+
const GetGroupsWithMenusResponse_1 = require("../Dtos/GetGroupsWithMenusResponse");
|
|
36
37
|
let PermissionController = PermissionController_1 = class PermissionController {
|
|
37
38
|
constructor(permissionService, options) {
|
|
38
39
|
this.permissionService = permissionService;
|
|
@@ -157,6 +158,17 @@ let PermissionController = PermissionController_1 = class PermissionController {
|
|
|
157
158
|
}
|
|
158
159
|
});
|
|
159
160
|
}
|
|
161
|
+
getGroupsWithMenus(res) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
try {
|
|
164
|
+
const menus = yield this.permissionService.getGroupsWithMenus();
|
|
165
|
+
return Utilities_1.RestUtilities.sendBaseResponse(res, menus);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, PermissionController_1.name);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
160
172
|
getUserRolesAndGrants(codiceUtente, res) {
|
|
161
173
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
174
|
try {
|
|
@@ -288,7 +300,7 @@ __decorate([
|
|
|
288
300
|
], PermissionController.prototype, "deleteRole", null);
|
|
289
301
|
__decorate([
|
|
290
302
|
(0, swagger_1.ApiOperation)({ summary: 'Recupera tutti i menù disponibili', operationId: "getMenus" }),
|
|
291
|
-
(0, swagger_1.ApiOkResponse)({ description: 'Elenco menù', type: GetMenusResponse_1.
|
|
303
|
+
(0, swagger_1.ApiOkResponse)({ description: 'Elenco menù', type: GetMenusResponse_1.GetMenusResponse }),
|
|
292
304
|
(0, swagger_1.ApiResponse)({ status: 200, description: "Lista dei menù recuperata con successo" }),
|
|
293
305
|
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
294
306
|
(0, common_1.Get)('menus'),
|
|
@@ -297,6 +309,17 @@ __decorate([
|
|
|
297
309
|
__metadata("design:paramtypes", [Object]),
|
|
298
310
|
__metadata("design:returntype", Promise)
|
|
299
311
|
], PermissionController.prototype, "getMenus", null);
|
|
312
|
+
__decorate([
|
|
313
|
+
(0, swagger_1.ApiOperation)({ summary: 'Recupera tutti i gruppi disponibili con i relativi menù', operationId: "getGroupsWithMenus" }),
|
|
314
|
+
(0, swagger_1.ApiOkResponse)({ description: 'Elenco gruppi con relativi menù', type: GetGroupsWithMenusResponse_1.GetGroupsWithMenusResponse }),
|
|
315
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Lista dei menù recuperata con successo" }),
|
|
316
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
317
|
+
(0, common_1.Get)('groups-with-menus'),
|
|
318
|
+
__param(0, (0, common_1.Res)()),
|
|
319
|
+
__metadata("design:type", Function),
|
|
320
|
+
__metadata("design:paramtypes", [Object]),
|
|
321
|
+
__metadata("design:returntype", Promise)
|
|
322
|
+
], PermissionController.prototype, "getGroupsWithMenus", null);
|
|
300
323
|
__decorate([
|
|
301
324
|
(0, swagger_1.ApiOperation)({ summary: 'Recupera i ruoli e i menù di un utente', operationId: "getUserRolesAndGrants" }),
|
|
302
325
|
(0, swagger_1.ApiOkResponse)({ description: 'Elenco menù', type: UserGrantsDto_1.UserGrantsDto }),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseResponse } from "./BaseResponse";
|
|
2
|
+
import { MenuEntity } from "./GetMenusResponse";
|
|
3
|
+
export declare class GroupWithMenusEntity {
|
|
4
|
+
codiceGruppo: string;
|
|
5
|
+
descrizioneGruppo: string;
|
|
6
|
+
ordineGruppo: number;
|
|
7
|
+
menus: MenuEntity[];
|
|
8
|
+
}
|
|
9
|
+
export declare class GetGroupsWithMenusResponse extends BaseResponse {
|
|
10
|
+
Result: GroupWithMenusEntity[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.GetGroupsWithMenusResponse = exports.GroupWithMenusEntity = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const BaseResponse_1 = require("./BaseResponse");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const class_transformer_1 = require("class-transformer");
|
|
17
|
+
const GetMenusResponse_1 = require("./GetMenusResponse");
|
|
18
|
+
class GroupWithMenusEntity {
|
|
19
|
+
}
|
|
20
|
+
exports.GroupWithMenusEntity = GroupWithMenusEntity;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, swagger_1.ApiProperty)({
|
|
23
|
+
description: "Codice univoco del gruppo.",
|
|
24
|
+
type: String,
|
|
25
|
+
example: "GRP01"
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], GroupWithMenusEntity.prototype, "codiceGruppo", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, swagger_1.ApiProperty)({
|
|
31
|
+
description: "Descrizione del gruppo.",
|
|
32
|
+
type: String,
|
|
33
|
+
example: "Gestione Accessi"
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], GroupWithMenusEntity.prototype, "descrizioneGruppo", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiProperty)({
|
|
39
|
+
description: "Ordine del gruppo.",
|
|
40
|
+
type: Number,
|
|
41
|
+
example: 1
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", Number)
|
|
44
|
+
], GroupWithMenusEntity.prototype, "ordineGruppo", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)({
|
|
47
|
+
description: "Lista dei menù associati al gruppo.",
|
|
48
|
+
type: [GetMenusResponse_1.MenuEntity]
|
|
49
|
+
}),
|
|
50
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
51
|
+
(0, class_transformer_1.Type)(() => GetMenusResponse_1.MenuEntity),
|
|
52
|
+
(0, class_validator_1.IsArray)(),
|
|
53
|
+
__metadata("design:type", Array)
|
|
54
|
+
], GroupWithMenusEntity.prototype, "menus", void 0);
|
|
55
|
+
class GetGroupsWithMenusResponse extends BaseResponse_1.BaseResponse {
|
|
56
|
+
}
|
|
57
|
+
exports.GetGroupsWithMenusResponse = GetGroupsWithMenusResponse;
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiProperty)({ type: [GroupWithMenusEntity] }),
|
|
60
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
61
|
+
(0, class_transformer_1.Type)(() => GroupWithMenusEntity),
|
|
62
|
+
__metadata("design:type", Array)
|
|
63
|
+
], GetGroupsWithMenusResponse.prototype, "Result", void 0);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
menus: MenuEntity[];
|
|
3
|
-
}
|
|
1
|
+
import { BaseResponse } from "./BaseResponse";
|
|
4
2
|
export declare class MenuEntity {
|
|
5
3
|
codiceMenu: string;
|
|
6
4
|
descrizioneMenu: string;
|
|
@@ -9,4 +7,9 @@ export declare class MenuEntity {
|
|
|
9
7
|
icona?: string;
|
|
10
8
|
tipo?: string;
|
|
11
9
|
pagina?: string;
|
|
10
|
+
ordineMenu: number;
|
|
11
|
+
ordineGruppo: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class GetMenusResponse extends BaseResponse {
|
|
14
|
+
Result: MenuEntity[];
|
|
12
15
|
}
|
|
@@ -9,11 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.GetMenusResponse = exports.MenuEntity = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const BaseResponse_1 = require("./BaseResponse");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const class_transformer_1 = require("class-transformer");
|
|
17
17
|
class MenuEntity {
|
|
18
18
|
}
|
|
19
19
|
exports.MenuEntity = MenuEntity;
|
|
@@ -78,3 +78,28 @@ __decorate([
|
|
|
78
78
|
}),
|
|
79
79
|
__metadata("design:type", String)
|
|
80
80
|
], MenuEntity.prototype, "pagina", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, swagger_1.ApiProperty)({
|
|
83
|
+
description: "Ordine del menu.",
|
|
84
|
+
type: Number,
|
|
85
|
+
example: 1
|
|
86
|
+
}),
|
|
87
|
+
__metadata("design:type", Number)
|
|
88
|
+
], MenuEntity.prototype, "ordineMenu", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, swagger_1.ApiProperty)({
|
|
91
|
+
description: "Ordine del gruppo.",
|
|
92
|
+
type: Number,
|
|
93
|
+
example: 1
|
|
94
|
+
}),
|
|
95
|
+
__metadata("design:type", Number)
|
|
96
|
+
], MenuEntity.prototype, "ordineGruppo", void 0);
|
|
97
|
+
class GetMenusResponse extends BaseResponse_1.BaseResponse {
|
|
98
|
+
}
|
|
99
|
+
exports.GetMenusResponse = GetMenusResponse;
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, swagger_1.ApiProperty)({ type: [MenuEntity] }),
|
|
102
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
103
|
+
(0, class_transformer_1.Type)(() => MenuEntity),
|
|
104
|
+
__metadata("design:type", Array)
|
|
105
|
+
], GetMenusResponse.prototype, "Result", void 0);
|
|
@@ -47,7 +47,7 @@ let EmailService = class EmailService {
|
|
|
47
47
|
if (result.length === 0) {
|
|
48
48
|
throw new Error("Email non trovata.");
|
|
49
49
|
}
|
|
50
|
-
const resetUrl = `${baseUrl}/api/accessi/email/reset-password/${resetToken}`;
|
|
50
|
+
const resetUrl = `${baseUrl}/api/accessi/email/reset-password-page/${resetToken}`;
|
|
51
51
|
const mailOptions = {
|
|
52
52
|
from: this.accessiOptions.emailOptions.from,
|
|
53
53
|
to: email,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AccessiOptions } from "../../AccessiModule";
|
|
2
2
|
import { Permission } from "../../Dtos";
|
|
3
3
|
import { AbilitazioneMenu } from "../../Dtos/AbilitazioneMenu";
|
|
4
|
+
import { GroupWithMenusEntity } from "../../Dtos/GetGroupsWithMenusResponse";
|
|
4
5
|
import { MenuEntity } from "../../Dtos/GetMenusResponse";
|
|
5
6
|
import { Role } from "../../Dtos/Role";
|
|
6
7
|
export declare class PermissionService {
|
|
@@ -14,6 +15,7 @@ export declare class PermissionService {
|
|
|
14
15
|
assignPermissionsToUser(codiceUtente: number, permissions: Permission[]): Promise<void>;
|
|
15
16
|
deleteRole(codiceRuolo: number): Promise<void>;
|
|
16
17
|
getMenus(): Promise<MenuEntity[]>;
|
|
18
|
+
getGroupsWithMenus(): Promise<GroupWithMenusEntity[]>;
|
|
17
19
|
getUserRolesAndGrants(codiceUtente: number): Promise<{
|
|
18
20
|
abilitazioni: AbilitazioneMenu[];
|
|
19
21
|
ruoli: Role[];
|
|
@@ -213,6 +213,50 @@ let PermissionService = class PermissionService {
|
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
|
+
getGroupsWithMenus() {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
+
try {
|
|
219
|
+
const query = `
|
|
220
|
+
SELECT
|
|
221
|
+
M.CODMNU AS codice_menu,
|
|
222
|
+
M.DESMNU AS descrizione_menu,
|
|
223
|
+
M.CODGRP AS codice_gruppo,
|
|
224
|
+
G.DESGRP AS descrizione_gruppo,
|
|
225
|
+
M.ICON AS icona,
|
|
226
|
+
M.CODTIP AS tipo,
|
|
227
|
+
M.PAGINA AS pagina,
|
|
228
|
+
G.ORDINE AS ordine_gruppo,
|
|
229
|
+
M.ORDINE as ordine_menu
|
|
230
|
+
FROM MENU M
|
|
231
|
+
LEFT JOIN MENU_GRP G ON M.CODGRP = G.CODGRP
|
|
232
|
+
WHERE M.FLGENABLED = 1
|
|
233
|
+
ORDER BY G.CODGRP, M.CODMNU
|
|
234
|
+
`;
|
|
235
|
+
const result = yield Orm_1.Orm.query(this.accessiOptions.databaseOptions, query, []);
|
|
236
|
+
// Process the result to group menus by their respective groups
|
|
237
|
+
const groupMap = new Map();
|
|
238
|
+
result.forEach(row => {
|
|
239
|
+
const menu = Utilities_1.RestUtilities.convertKeysToCamelCase(row);
|
|
240
|
+
const groupKey = menu.codiceGruppo;
|
|
241
|
+
if (!groupMap.has(groupKey)) {
|
|
242
|
+
groupMap.set(groupKey, {
|
|
243
|
+
codiceGruppo: menu.codiceGruppo,
|
|
244
|
+
descrizioneGruppo: menu.descrizioneGruppo,
|
|
245
|
+
ordineGruppo: menu.ordineGruppo,
|
|
246
|
+
menus: []
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
groupMap.get(groupKey).menus.push(menu);
|
|
250
|
+
groupMap.get(groupKey).menus = groupMap.get(groupKey).menus.sort((a, b) => a.ordineMenu - b.ordineMenu);
|
|
251
|
+
});
|
|
252
|
+
let groupsArray = Array.from(groupMap.values()).sort((a, b) => a.ordineGruppo - b.ordineGruppo);
|
|
253
|
+
return groupsArray;
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
throw error;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
216
260
|
getUserRolesAndGrants(codiceUtente) {
|
|
217
261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
218
262
|
try {
|
|
@@ -29,8 +29,10 @@ const core_1 = require("@nestjs/core");
|
|
|
29
29
|
const platform_express_1 = require("@nestjs/platform-express");
|
|
30
30
|
const AccessiModule_1 = require("./AccessiModule");
|
|
31
31
|
const SwaggerConfig_1 = require("./swagger/SwaggerConfig");
|
|
32
|
+
const Logger_1 = require("../Logger");
|
|
32
33
|
function initializeAccessiModule(app, options) {
|
|
33
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const logger = new Logger_1.Logger("initializeAccessiModule");
|
|
34
36
|
try {
|
|
35
37
|
// Creiamo un'istanza Express separata per NestJS
|
|
36
38
|
const nestExpressInstance = new platform_express_1.ExpressAdapter(app);
|
|
@@ -44,30 +46,9 @@ function initializeAccessiModule(app, options) {
|
|
|
44
46
|
});
|
|
45
47
|
(0, SwaggerConfig_1.setupSwagger)(nestApp);
|
|
46
48
|
yield nestApp.init();
|
|
47
|
-
/*
|
|
48
|
-
console.log('Verifica API NestJS registrate:');
|
|
49
|
-
const server = nestApp.getHttpAdapter().getInstance();
|
|
50
|
-
const router = server.router;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const availableRoutes: [] = router.stack
|
|
54
|
-
.map(layer => {
|
|
55
|
-
if (layer.route) {
|
|
56
|
-
return {
|
|
57
|
-
route: {
|
|
58
|
-
path: layer.route?.path,
|
|
59
|
-
method: layer.route?.stack[0].method,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
.filter(item => item !== undefined);
|
|
65
|
-
console.log(availableRoutes);
|
|
66
|
-
|
|
67
|
-
*/
|
|
68
49
|
}
|
|
69
50
|
catch (error) {
|
|
70
|
-
|
|
51
|
+
logger.error("Errore in initialize AccessiModule:", error);
|
|
71
52
|
throw error;
|
|
72
53
|
}
|
|
73
54
|
});
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupSwagger = setupSwagger;
|
|
4
4
|
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
-
const
|
|
6
|
-
const swaggerJsonPath = `${swaggerPath}-json`;
|
|
5
|
+
const Logger_1 = require("../../Logger");
|
|
7
6
|
function setupSwagger(app) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const logger = new Logger_1.Logger("SwaggerConfig");
|
|
9
|
+
const swaggerPath = "swagger/accessi";
|
|
10
|
+
const swaggerJsonPath = `${swaggerPath}-json`;
|
|
8
11
|
const config = new swagger_1.DocumentBuilder()
|
|
9
12
|
.setTitle("Accessi API")
|
|
10
13
|
.setDescription("API per la gestione degli accessi utenti")
|
|
@@ -14,9 +17,9 @@ function setupSwagger(app) {
|
|
|
14
17
|
const document = swagger_1.SwaggerModule.createDocument(app, config);
|
|
15
18
|
swagger_1.SwaggerModule.setup(swaggerPath, app, document);
|
|
16
19
|
app.use(`/${swaggerJsonPath}`, (_, res) => {
|
|
17
|
-
res.setHeader(
|
|
20
|
+
res.setHeader("Content-Type", "application/json");
|
|
18
21
|
res.send(document);
|
|
19
22
|
});
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
let port = ((_b = (_a = app.getHttpServer()) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.port) || 3000;
|
|
24
|
+
logger.info(`Swagger disponibile su: http://localhost:${port}/${swaggerPath}`);
|
|
22
25
|
}
|
|
@@ -58,7 +58,7 @@ function testDocumentGenerator() {
|
|
|
58
58
|
};
|
|
59
59
|
try {
|
|
60
60
|
const output = yield generator.generateDocument(params);
|
|
61
|
-
console.log("Document generated successfully:", output);
|
|
61
|
+
//console.log("Document generated successfully:", output);
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
64
64
|
console.error("Error generating document:", error);
|