emilsoftware-utilities 1.3.98 → 1.3.99
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/accessi-module/Controllers/AccessiController.d.ts +1 -2
- package/dist/accessi-module/Controllers/AccessiController.js +1 -21
- package/dist/accessi-module/Controllers/AuthController.d.ts +1 -1
- package/dist/accessi-module/Controllers/AuthController.js +5 -3
- package/dist/accessi-module/Controllers/PermissionController.d.ts +5 -3
- package/dist/accessi-module/Controllers/PermissionController.js +76 -20
- package/dist/accessi-module/Controllers/UserController.d.ts +1 -1
- package/dist/accessi-module/Controllers/UserController.js +49 -23
- package/dist/accessi-module/Dtos/GetMenusResponse.d.ts +12 -0
- package/dist/accessi-module/Dtos/GetMenusResponse.js +80 -0
- package/dist/accessi-module/{models/QueryResults/UserQueryResult.d.ts → Dtos/GetUsersResponse.d.ts} +2 -2
- package/dist/accessi-module/Dtos/GetUsersResponse.js +252 -0
- package/dist/accessi-module/Dtos/LoginRequest.d.ts +1 -1
- package/dist/accessi-module/Dtos/LoginRequest.js +4 -4
- package/dist/accessi-module/Dtos/LoginResult.js +1 -1
- package/dist/accessi-module/Dtos/MenuItem.d.ts +0 -6
- package/dist/accessi-module/Dtos/MenuItem.js +0 -33
- package/dist/accessi-module/Dtos/Role.d.ts +12 -0
- package/dist/accessi-module/Dtos/{RoleWithMenus.js → Role.js} +26 -8
- package/dist/accessi-module/Dtos/User.d.ts +4 -1
- package/dist/accessi-module/Dtos/User.js +10 -3
- package/dist/accessi-module/Dtos/index.d.ts +1 -2
- package/dist/accessi-module/Dtos/index.js +1 -2
- package/dist/accessi-module/Services/AuthService/AuthService.js +17 -5
- package/dist/accessi-module/Services/PermissionService/PermissionService.d.ts +6 -3
- package/dist/accessi-module/Services/PermissionService/PermissionService.js +63 -8
- package/dist/accessi-module/Services/UserService/UserService.d.ts +5 -5
- package/dist/accessi-module/Services/UserService/UserService.js +18 -13
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -3
- package/package.json +1 -1
- package/dist/accessi-module/Dtos/RoleWithMenus.d.ts +0 -6
- package/dist/accessi-module/models/QueryResults/MenuAbilitazioniResult.d.ts +0 -11
- package/dist/accessi-module/models/QueryResults/MenuAbilitazioniResult.js +0 -2
- package/dist/accessi-module/models/QueryResults/UserQueryResult.js +0 -2
|
@@ -16,7 +16,7 @@ export declare class AccessiController {
|
|
|
16
16
|
resetPassword(res: Response, token: string, newPassword: string): Promise<Response<any, Record<string, any>>>;
|
|
17
17
|
getUserByToken(token: string, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
18
18
|
login(loginDto: {
|
|
19
|
-
|
|
19
|
+
email: string;
|
|
20
20
|
password: string;
|
|
21
21
|
}, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
22
22
|
getUsers(res: Response): Promise<Response<any, Record<string, any>>>;
|
|
@@ -29,6 +29,5 @@ export declare class AccessiController {
|
|
|
29
29
|
codiceUtente: string;
|
|
30
30
|
nuovaPassword: string;
|
|
31
31
|
}, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
32
|
-
updateUtente(user: any, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
33
32
|
setGdpr(codiceUtente: string, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
34
33
|
}
|
|
@@ -157,7 +157,7 @@ let AccessiController = AccessiController_1 = class AccessiController {
|
|
|
157
157
|
}
|
|
158
158
|
yield this.userService.register(registrationData);
|
|
159
159
|
let confirmationEmailPrefix = protocol + "://" + host;
|
|
160
|
-
yield this.emailService.sendPasswordResetEmail(registrationData.
|
|
160
|
+
yield this.emailService.sendPasswordResetEmail(registrationData.email, confirmationEmailPrefix);
|
|
161
161
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'utente è stato registrato con successo, email di conferma inoltrata al destinatario.");
|
|
162
162
|
}
|
|
163
163
|
catch (error) {
|
|
@@ -209,17 +209,6 @@ let AccessiController = AccessiController_1 = class AccessiController {
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
updateUtente(user, res) {
|
|
213
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
try {
|
|
215
|
-
yield this.userService.updateUser(user);
|
|
216
|
-
return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${user.codiceUtente} è stato aggiornato con successo.`);
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
212
|
setGdpr(codiceUtente, res) {
|
|
224
213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
214
|
try {
|
|
@@ -331,15 +320,6 @@ __decorate([
|
|
|
331
320
|
__metadata("design:paramtypes", [Object, Object]),
|
|
332
321
|
__metadata("design:returntype", Promise)
|
|
333
322
|
], AccessiController.prototype, "setPassword", null);
|
|
334
|
-
__decorate([
|
|
335
|
-
(0, swagger_1.ApiOperation)({ summary: 'Aggiorna un utente esistente' }),
|
|
336
|
-
(0, common_1.Post)('update-utente'),
|
|
337
|
-
__param(0, (0, common_1.Body)()),
|
|
338
|
-
__param(1, (0, common_1.Res)()),
|
|
339
|
-
__metadata("design:type", Function),
|
|
340
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
341
|
-
__metadata("design:returntype", Promise)
|
|
342
|
-
], AccessiController.prototype, "updateUtente", null);
|
|
343
323
|
__decorate([
|
|
344
324
|
(0, swagger_1.ApiOperation)({ summary: 'Imposta il consenso GDPR' }),
|
|
345
325
|
(0, common_1.Post)('set-gdpr'),
|
|
@@ -8,7 +8,7 @@ export declare class AuthController {
|
|
|
8
8
|
resetPassword(res: Response, token: string, newPassword: string): Promise<Response<any, Record<string, any>>>;
|
|
9
9
|
getUserByToken(token: string, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
10
10
|
login(loginDto: {
|
|
11
|
-
|
|
11
|
+
email: string;
|
|
12
12
|
password: string;
|
|
13
13
|
}, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
14
14
|
}
|
|
@@ -140,12 +140,14 @@ __decorate([
|
|
|
140
140
|
], AuthController.prototype, "getUserByToken", null);
|
|
141
141
|
__decorate([
|
|
142
142
|
(0, swagger_1.ApiOperation)({ summary: 'Effettua il login' }),
|
|
143
|
-
(0, swagger_1.ApiBody)({
|
|
143
|
+
(0, swagger_1.ApiBody)({
|
|
144
|
+
schema: {
|
|
144
145
|
properties: {
|
|
145
|
-
|
|
146
|
+
email: { type: 'string', description: 'Email dell\'utente' },
|
|
146
147
|
password: { type: 'string', description: 'Password dell\'utente' }
|
|
147
148
|
}
|
|
148
|
-
}
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
149
151
|
(0, swagger_1.ApiResponse)({ status: 200, description: 'Login effettuato con successo' }),
|
|
150
152
|
(0, swagger_1.ApiResponse)({ status: 401, description: 'Credenziali non valide' }),
|
|
151
153
|
(0, common_1.Post)('login'),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Response } from 'express';
|
|
2
2
|
import { AccessiOptions } from '../AccessiModule';
|
|
3
3
|
import { PermissionService } from '../Services/PermissionService/PermissionService';
|
|
4
|
-
import {
|
|
4
|
+
import { Role } from '../Dtos/Role';
|
|
5
5
|
import { AssignRolesToUserRequest } from '../Dtos/AssignRolesToUserRequest';
|
|
6
6
|
import { AssignPermissionsToUserRequest } from '../Dtos/AssignPermissionsToUserRequest';
|
|
7
7
|
export declare class PermissionController {
|
|
@@ -13,8 +13,10 @@ export declare class PermissionController {
|
|
|
13
13
|
* @returns Un array di ruoli con menù associati.
|
|
14
14
|
*/
|
|
15
15
|
getRoles(res: Response): Promise<void>;
|
|
16
|
-
updateRole(
|
|
17
|
-
createRole(res: Response, role:
|
|
16
|
+
updateRole(codiceRuolo: string, role: Role, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
17
|
+
createRole(res: Response, role: Role): Promise<Response<any, Record<string, any>>>;
|
|
18
18
|
assignRolesToUser(res: Response, codiceUtente: string, assignRolesRequest: AssignRolesToUserRequest): Promise<Response<any, Record<string, any>>>;
|
|
19
19
|
assignPermissionsToUser(res: Response, codiceUtente: string, assignPermissionsRequest: AssignPermissionsToUserRequest): Promise<Response<any, Record<string, any>>>;
|
|
20
|
+
deleteRole(codiceRuolo: number, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
21
|
+
getMenus(res: Response): Promise<Response<any, Record<string, any>>>;
|
|
20
22
|
}
|
|
@@ -27,7 +27,7 @@ const common_1 = require("@nestjs/common");
|
|
|
27
27
|
const swagger_1 = require("@nestjs/swagger");
|
|
28
28
|
const Utilities_1 = require("../../Utilities");
|
|
29
29
|
const PermissionService_1 = require("../Services/PermissionService/PermissionService");
|
|
30
|
-
const
|
|
30
|
+
const Role_1 = require("../Dtos/Role");
|
|
31
31
|
const AssignRolesToUserRequest_1 = require("../Dtos/AssignRolesToUserRequest");
|
|
32
32
|
const AssignPermissionsToUserRequest_1 = require("../Dtos/AssignPermissionsToUserRequest");
|
|
33
33
|
let PermissionController = PermissionController_1 = class PermissionController {
|
|
@@ -64,19 +64,17 @@ let PermissionController = PermissionController_1 = class PermissionController {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
updateRole(
|
|
67
|
+
updateRole(codiceRuolo, role, res) {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
try {
|
|
70
|
-
if (!
|
|
71
|
-
throw new Error("Il
|
|
72
|
-
if (!role.codiceRuolo)
|
|
73
|
-
throw new Error("Il codice del ruolo non può essere vuoto.");
|
|
70
|
+
if (!codiceRuolo)
|
|
71
|
+
throw new Error("Il codice del ruolo è obbligatorio.");
|
|
74
72
|
if (!role.descrizioneRuolo)
|
|
75
73
|
throw new Error("La descrizione del ruolo non può essere vuota.");
|
|
76
74
|
if (!role.menu || role.menu.length === 0)
|
|
77
75
|
throw new Error("Il ruolo deve avere almeno un menù.");
|
|
78
|
-
yield this.permissionService.updateOrInsertRole(role);
|
|
79
|
-
return Utilities_1.RestUtilities.sendOKMessage(res,
|
|
76
|
+
yield this.permissionService.updateOrInsertRole(role, codiceRuolo);
|
|
77
|
+
return Utilities_1.RestUtilities.sendOKMessage(res, `Il ruolo ${codiceRuolo} è stato aggiornato con successo.`);
|
|
80
78
|
}
|
|
81
79
|
catch (error) {
|
|
82
80
|
return Utilities_1.RestUtilities.sendErrorMessage(res, error, PermissionController_1.name);
|
|
@@ -132,11 +130,35 @@ let PermissionController = PermissionController_1 = class PermissionController {
|
|
|
132
130
|
}
|
|
133
131
|
});
|
|
134
132
|
}
|
|
133
|
+
deleteRole(codiceRuolo, res) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
try {
|
|
136
|
+
if (!codiceRuolo)
|
|
137
|
+
throw new Error("Il codice del ruolo è obbligatorio.");
|
|
138
|
+
yield this.permissionService.deleteRole(codiceRuolo);
|
|
139
|
+
return Utilities_1.RestUtilities.sendOKMessage(res, `Il ruolo ${codiceRuolo} è stato eliminato con successo.`);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, PermissionController_1.name);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
getMenus(res) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
try {
|
|
149
|
+
const menus = yield this.permissionService.getMenus();
|
|
150
|
+
return Utilities_1.RestUtilities.sendBaseResponse(res, menus);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, PermissionController_1.name);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
135
157
|
};
|
|
136
158
|
exports.PermissionController = PermissionController;
|
|
137
159
|
__decorate([
|
|
138
160
|
(0, swagger_1.ApiOperation)({ summary: 'Ritorna i ruoli disponibili con i relativi menù', description: 'Recupera tutti i ruoli presenti nel sistema con le relative voci di menu accessibili.' }),
|
|
139
|
-
(0, swagger_1.ApiOkResponse)({ description: 'Elenco dei ruoli con i rispettivi menù', type: [
|
|
161
|
+
(0, swagger_1.ApiOkResponse)({ description: 'Elenco dei ruoli con i rispettivi menù', type: [Role_1.Role] }),
|
|
140
162
|
(0, swagger_1.ApiInternalServerErrorResponse)({ description: 'Errore interno del server' }),
|
|
141
163
|
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.OK, description: 'Lista dei ruoli con i menù restituita con successo.' }),
|
|
142
164
|
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.INTERNAL_SERVER_ERROR, description: 'Errore interno del server durante il recupero dei ruoli.' }),
|
|
@@ -148,19 +170,25 @@ __decorate([
|
|
|
148
170
|
], PermissionController.prototype, "getRoles", null);
|
|
149
171
|
__decorate([
|
|
150
172
|
(0, swagger_1.ApiOperation)({ summary: 'Aggiorna un ruolo esistente' }),
|
|
151
|
-
(0, swagger_1.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
(0, swagger_1.ApiBody)({
|
|
155
|
-
description: 'Dati del ruolo da aggiornare',
|
|
173
|
+
(0, swagger_1.ApiParam)({
|
|
174
|
+
name: 'codiceRuolo',
|
|
175
|
+
description: "Codice identificativo del ruolo da aggiornare",
|
|
156
176
|
required: true,
|
|
157
|
-
|
|
177
|
+
example: "ROLE_ADMIN"
|
|
158
178
|
}),
|
|
159
|
-
(0,
|
|
160
|
-
|
|
179
|
+
(0, swagger_1.ApiBody)({
|
|
180
|
+
description: "Dati aggiornati del ruolo (escluso il codice ruolo, che è nel path)",
|
|
181
|
+
type: Role_1.Role
|
|
182
|
+
}),
|
|
183
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Il ruolo è stato aggiornato con successo" }),
|
|
184
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore di validazione nei dati inviati" }),
|
|
185
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
186
|
+
(0, common_1.Put)('update-role/:codiceRuolo'),
|
|
187
|
+
__param(0, (0, common_1.Param)('codiceRuolo')),
|
|
161
188
|
__param(1, (0, common_1.Body)()),
|
|
189
|
+
__param(2, (0, common_1.Res)()),
|
|
162
190
|
__metadata("design:type", Function),
|
|
163
|
-
__metadata("design:paramtypes", [
|
|
191
|
+
__metadata("design:paramtypes", [String, Role_1.Role, Object]),
|
|
164
192
|
__metadata("design:returntype", Promise)
|
|
165
193
|
], PermissionController.prototype, "updateRole", null);
|
|
166
194
|
__decorate([
|
|
@@ -171,13 +199,13 @@ __decorate([
|
|
|
171
199
|
(0, swagger_1.ApiBody)({
|
|
172
200
|
description: 'Dati del nuovo ruolo',
|
|
173
201
|
required: true,
|
|
174
|
-
type:
|
|
202
|
+
type: Role_1.Role
|
|
175
203
|
}),
|
|
176
204
|
(0, common_1.Post)('create-role'),
|
|
177
205
|
__param(0, (0, common_1.Res)()),
|
|
178
206
|
__param(1, (0, common_1.Body)()),
|
|
179
207
|
__metadata("design:type", Function),
|
|
180
|
-
__metadata("design:paramtypes", [Object,
|
|
208
|
+
__metadata("design:paramtypes", [Object, Role_1.Role]),
|
|
181
209
|
__metadata("design:returntype", Promise)
|
|
182
210
|
], PermissionController.prototype, "createRole", null);
|
|
183
211
|
__decorate([
|
|
@@ -226,6 +254,34 @@ __decorate([
|
|
|
226
254
|
__metadata("design:paramtypes", [Object, String, AssignPermissionsToUserRequest_1.AssignPermissionsToUserRequest]),
|
|
227
255
|
__metadata("design:returntype", Promise)
|
|
228
256
|
], PermissionController.prototype, "assignPermissionsToUser", null);
|
|
257
|
+
__decorate([
|
|
258
|
+
(0, swagger_1.ApiOperation)({ summary: 'Elimina un ruolo esistente' }),
|
|
259
|
+
(0, swagger_1.ApiParam)({
|
|
260
|
+
name: 'codiceRuolo',
|
|
261
|
+
description: "Codice identificativo del ruolo da eliminare",
|
|
262
|
+
required: true,
|
|
263
|
+
example: 382
|
|
264
|
+
}),
|
|
265
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Ruolo eliminato con successo" }),
|
|
266
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nei parametri della richiesta" }),
|
|
267
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
268
|
+
(0, common_1.Delete)('delete-role/:codiceRuolo'),
|
|
269
|
+
__param(0, (0, common_1.Param)('codiceRuolo')),
|
|
270
|
+
__param(1, (0, common_1.Res)()),
|
|
271
|
+
__metadata("design:type", Function),
|
|
272
|
+
__metadata("design:paramtypes", [Number, Object]),
|
|
273
|
+
__metadata("design:returntype", Promise)
|
|
274
|
+
], PermissionController.prototype, "deleteRole", null);
|
|
275
|
+
__decorate([
|
|
276
|
+
(0, swagger_1.ApiOperation)({ summary: 'Recupera tutti i menù disponibili' }),
|
|
277
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Lista dei menù recuperata con successo" }),
|
|
278
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
279
|
+
(0, common_1.Get)('menus'),
|
|
280
|
+
__param(0, (0, common_1.Res)()),
|
|
281
|
+
__metadata("design:type", Function),
|
|
282
|
+
__metadata("design:paramtypes", [Object]),
|
|
283
|
+
__metadata("design:returntype", Promise)
|
|
284
|
+
], PermissionController.prototype, "getMenus", null);
|
|
229
285
|
exports.PermissionController = PermissionController = PermissionController_1 = __decorate([
|
|
230
286
|
(0, swagger_1.ApiTags)('Permission'),
|
|
231
287
|
(0, common_1.Controller)('accessi/permission'),
|
|
@@ -12,6 +12,6 @@ export declare class UserController {
|
|
|
12
12
|
getUsers(res: Response): Promise<Response<any, Record<string, any>>>;
|
|
13
13
|
deleteUser(codiceUtente: string, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
14
14
|
register(request: Request, registrationData: User, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
15
|
-
updateUtente(user: User, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
15
|
+
updateUtente(codiceUtente: string, user: User, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
16
16
|
setGdpr(codiceUtente: string, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
17
17
|
}
|
|
@@ -30,6 +30,7 @@ const UserService_1 = require("../Services/UserService/UserService");
|
|
|
30
30
|
const EmailService_1 = require("../Services/EmailService/EmailService");
|
|
31
31
|
const path_1 = require("path");
|
|
32
32
|
const Dtos_1 = require("../Dtos");
|
|
33
|
+
const GetUsersResponse_1 = require("../Dtos/GetUsersResponse");
|
|
33
34
|
let UserController = UserController_1 = class UserController {
|
|
34
35
|
constructor(userService, emailService, options) {
|
|
35
36
|
this.userService = userService;
|
|
@@ -75,7 +76,7 @@ let UserController = UserController_1 = class UserController {
|
|
|
75
76
|
}
|
|
76
77
|
yield this.userService.register(registrationData);
|
|
77
78
|
let confirmationEmailPrefix = `${protocol}://${host}`;
|
|
78
|
-
yield this.emailService.sendPasswordResetEmail(registrationData.
|
|
79
|
+
yield this.emailService.sendPasswordResetEmail(registrationData.email, confirmationEmailPrefix);
|
|
79
80
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'utente è stato registrato con successo, email di conferma inoltrata al destinatario.");
|
|
80
81
|
}
|
|
81
82
|
catch (error) {
|
|
@@ -83,11 +84,13 @@ let UserController = UserController_1 = class UserController {
|
|
|
83
84
|
}
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
|
-
updateUtente(user, res) {
|
|
87
|
+
updateUtente(codiceUtente, user, res) {
|
|
87
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
89
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
if (!codiceUtente)
|
|
91
|
+
throw new Error("Il codice utente è obbligatorio.");
|
|
92
|
+
yield this.userService.updateUser(codiceUtente, user);
|
|
93
|
+
return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} è stato aggiornato con successo.`);
|
|
91
94
|
}
|
|
92
95
|
catch (error) {
|
|
93
96
|
return Utilities_1.RestUtilities.sendErrorMessage(res, error, UserController_1.name);
|
|
@@ -97,6 +100,8 @@ let UserController = UserController_1 = class UserController {
|
|
|
97
100
|
setGdpr(codiceUtente, res) {
|
|
98
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
102
|
try {
|
|
103
|
+
if (!codiceUtente)
|
|
104
|
+
throw new Error("Il codice utente è obbligatorio.");
|
|
100
105
|
yield this.userService.setGdpr(codiceUtente);
|
|
101
106
|
return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} ha accettato il GDPR.`);
|
|
102
107
|
}
|
|
@@ -119,7 +124,7 @@ __decorate([
|
|
|
119
124
|
], UserController.prototype, "serveResetPasswordPage", null);
|
|
120
125
|
__decorate([
|
|
121
126
|
(0, swagger_1.ApiOperation)({ summary: 'Recupera la lista degli utenti' }),
|
|
122
|
-
(0, swagger_1.ApiResponse)({ status: 200, description: 'Lista utenti recuperata con successo' }),
|
|
127
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Lista utenti recuperata con successo', type: [GetUsersResponse_1.GetUsersResponse] }),
|
|
123
128
|
(0, swagger_1.ApiResponse)({ status: 401, description: 'Credenziali non valide' }),
|
|
124
129
|
(0, common_1.Get)('get-users'),
|
|
125
130
|
__param(0, (0, common_1.Res)()),
|
|
@@ -129,11 +134,17 @@ __decorate([
|
|
|
129
134
|
], UserController.prototype, "getUsers", null);
|
|
130
135
|
__decorate([
|
|
131
136
|
(0, swagger_1.ApiOperation)({ summary: 'Elimina un utente' }),
|
|
132
|
-
(0, swagger_1.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
(0, swagger_1.ApiParam)({
|
|
138
|
+
name: 'codiceUtente',
|
|
139
|
+
description: "Codice identificativo dell'utente da eliminare",
|
|
140
|
+
required: true,
|
|
141
|
+
example: "USR123"
|
|
142
|
+
}),
|
|
143
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Utente eliminato con successo" }),
|
|
144
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nei parametri della richiesta" }),
|
|
145
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
146
|
+
(0, common_1.Delete)('delete-user/:codiceUtente'),
|
|
147
|
+
__param(0, (0, common_1.Param)('codiceUtente')),
|
|
137
148
|
__param(1, (0, common_1.Res)()),
|
|
138
149
|
__metadata("design:type", Function),
|
|
139
150
|
__metadata("design:paramtypes", [String, Object]),
|
|
@@ -154,23 +165,38 @@ __decorate([
|
|
|
154
165
|
], UserController.prototype, "register", null);
|
|
155
166
|
__decorate([
|
|
156
167
|
(0, swagger_1.ApiOperation)({ summary: 'Aggiorna un utente esistente' }),
|
|
157
|
-
(0, swagger_1.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
(0, swagger_1.ApiParam)({
|
|
169
|
+
name: 'codiceUtente',
|
|
170
|
+
description: "Codice identificativo dell'utente da aggiornare",
|
|
171
|
+
required: true,
|
|
172
|
+
example: "USR123"
|
|
173
|
+
}),
|
|
174
|
+
(0, swagger_1.ApiBody)({
|
|
175
|
+
type: Dtos_1.User,
|
|
176
|
+
description: "Dati aggiornati dell'utente (escluso il codice utente, che è nel path)"
|
|
177
|
+
}),
|
|
178
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Utente aggiornato con successo" }),
|
|
179
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nell'aggiornamento" }),
|
|
180
|
+
(0, common_1.Put)('update-user/:codiceUtente'),
|
|
181
|
+
__param(0, (0, common_1.Param)('codiceUtente')),
|
|
182
|
+
__param(1, (0, common_1.Body)()),
|
|
183
|
+
__param(2, (0, common_1.Res)()),
|
|
163
184
|
__metadata("design:type", Function),
|
|
164
|
-
__metadata("design:paramtypes", [Dtos_1.User, Object]),
|
|
185
|
+
__metadata("design:paramtypes", [String, Dtos_1.User, Object]),
|
|
165
186
|
__metadata("design:returntype", Promise)
|
|
166
187
|
], UserController.prototype, "updateUtente", null);
|
|
167
188
|
__decorate([
|
|
168
|
-
(0, swagger_1.ApiOperation)({ summary:
|
|
169
|
-
(0, swagger_1.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
(0, swagger_1.ApiOperation)({ summary: "Imposta il consenso GDPR per un utente" }),
|
|
190
|
+
(0, swagger_1.ApiParam)({
|
|
191
|
+
name: "codiceUtente",
|
|
192
|
+
description: "Codice identificativo dell'utente che accetta il GDPR",
|
|
193
|
+
required: true,
|
|
194
|
+
example: "USR123"
|
|
195
|
+
}),
|
|
196
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: "Consenso GDPR impostato con successo" }),
|
|
197
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nella richiesta" }),
|
|
198
|
+
(0, common_1.Patch)('set-gdpr/:codiceUtente'),
|
|
199
|
+
__param(0, (0, common_1.Param)('codiceUtente')),
|
|
174
200
|
__param(1, (0, common_1.Res)()),
|
|
175
201
|
__metadata("design:type", Function),
|
|
176
202
|
__metadata("design:paramtypes", [String, Object]),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class GetMenusResponse {
|
|
2
|
+
menus: MenuEntity[];
|
|
3
|
+
}
|
|
4
|
+
export declare class MenuEntity {
|
|
5
|
+
codiceMenu: string;
|
|
6
|
+
descrizioneMenu: string;
|
|
7
|
+
codiceGruppo?: string;
|
|
8
|
+
descrizioneGruppo?: string;
|
|
9
|
+
icona?: string;
|
|
10
|
+
tipo?: string;
|
|
11
|
+
pagina?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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.MenuEntity = exports.GetMenusResponse = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
class GetMenusResponse {
|
|
15
|
+
}
|
|
16
|
+
exports.GetMenusResponse = GetMenusResponse;
|
|
17
|
+
class MenuEntity {
|
|
18
|
+
}
|
|
19
|
+
exports.MenuEntity = MenuEntity;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiProperty)({
|
|
22
|
+
description: "Codice univoco del menù.",
|
|
23
|
+
type: String,
|
|
24
|
+
example: "MNU001"
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], MenuEntity.prototype, "codiceMenu", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({
|
|
30
|
+
description: "Descrizione del menù.",
|
|
31
|
+
type: String,
|
|
32
|
+
example: "Gestione Utenti"
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], MenuEntity.prototype, "descrizioneMenu", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, swagger_1.ApiProperty)({
|
|
38
|
+
description: "Codice del gruppo a cui appartiene il menù.",
|
|
39
|
+
type: String,
|
|
40
|
+
example: "GRP01",
|
|
41
|
+
required: false
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], MenuEntity.prototype, "codiceGruppo", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)({
|
|
47
|
+
description: "Descrizione del gruppo a cui appartiene il menù.",
|
|
48
|
+
type: String,
|
|
49
|
+
example: "Gestione Accessi",
|
|
50
|
+
required: false
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], MenuEntity.prototype, "descrizioneGruppo", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, swagger_1.ApiProperty)({
|
|
56
|
+
description: "Percorso dell'icona associata al menù.",
|
|
57
|
+
type: String,
|
|
58
|
+
example: "fa-users",
|
|
59
|
+
required: false
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], MenuEntity.prototype, "icona", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)({
|
|
65
|
+
description: "Tipo di menù.",
|
|
66
|
+
type: String,
|
|
67
|
+
example: "admin",
|
|
68
|
+
required: false
|
|
69
|
+
}),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], MenuEntity.prototype, "tipo", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, swagger_1.ApiProperty)({
|
|
74
|
+
description: "Percorso della pagina associata al menù.",
|
|
75
|
+
type: String,
|
|
76
|
+
example: "/accessi/gestione-utenti",
|
|
77
|
+
required: false
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], MenuEntity.prototype, "pagina", void 0);
|