emilsoftware-utilities 1.4.0 → 1.5.0-dev.1
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/README.MD +34 -0
- package/dist/Utilities.d.ts +1 -0
- package/dist/Utilities.js +8 -0
- package/dist/accessi-module/AccessiModule.d.ts +11 -2
- package/dist/accessi-module/Controllers/AuthController.js +18 -0
- package/dist/accessi-module/Controllers/EmailController.d.ts +1 -0
- package/dist/accessi-module/Controllers/EmailController.js +33 -6
- package/dist/accessi-module/Controllers/UserController.d.ts +2 -0
- package/dist/accessi-module/Controllers/UserController.js +132 -30
- package/dist/accessi-module/Dtos/FiltriUtente.d.ts +3 -2
- package/dist/accessi-module/Dtos/FiltriUtente.js +10 -6
- package/dist/accessi-module/Dtos/RegisterRequest.d.ts +7 -5
- package/dist/accessi-module/Dtos/RegisterRequest.js +90 -21
- package/dist/accessi-module/Dtos/SetStatoRegistrazione.d.ts +5 -0
- package/dist/accessi-module/Dtos/SetStatoRegistrazione.js +32 -0
- package/dist/accessi-module/Dtos/StatoRegistrazione.d.ts +1 -0
- package/dist/accessi-module/Dtos/StatoRegistrazione.js +2 -1
- package/dist/accessi-module/Dtos/UserDto.d.ts +5 -4
- package/dist/accessi-module/Dtos/UserDto.js +85 -34
- package/dist/accessi-module/Services/AuthService/AuthService.js +17 -9
- package/dist/accessi-module/Services/EmailService/EmailService.d.ts +1 -1
- package/dist/accessi-module/Services/EmailService/EmailService.js +70 -32
- package/dist/accessi-module/Services/UserService/UserService.d.ts +10 -7
- package/dist/accessi-module/Services/UserService/UserService.js +126 -39
- package/dist/emilsoftware-utilities-1.5.0-dev.1.tgz +0 -0
- package/package.json +1 -1
- package/dist/emilsoftware-utilities-1.4.0.tgz +0 -0
package/README.MD
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Convenzioni per i Commit Message
|
|
2
|
+
|
|
3
|
+
1. feat:
|
|
4
|
+
Descrizione: Nuova feature
|
|
5
|
+
Esempio: feat: aggiunta endpoint per notifiche
|
|
6
|
+
Trigger: MINOR release (es. 1.3.0 -> 1.4.0)
|
|
7
|
+
Su dev: 1.4.0-dev.0
|
|
8
|
+
|
|
9
|
+
2. fix:
|
|
10
|
+
Descrizione: Correzione di bug
|
|
11
|
+
Esempio: fix: gestione errore null in login
|
|
12
|
+
Trigger: PATCH release (es. 1.3.1)
|
|
13
|
+
Su dev: 1.3.1-dev.0
|
|
14
|
+
|
|
15
|
+
3. BREAKING CHANGE:
|
|
16
|
+
Descrizione: Cambiamento che rompe la compatibilità all'indietro
|
|
17
|
+
Esempio:
|
|
18
|
+
feat!: rimozione supporto legacy
|
|
19
|
+
BREAKING CHANGE: cambia lo schema JWT
|
|
20
|
+
Trigger: MAJOR release (es. 1.0.0 -> 2.0.0)
|
|
21
|
+
|
|
22
|
+
4. Altri tipi di commit
|
|
23
|
+
Esempi: chore:, docs:, test:, refactor:
|
|
24
|
+
Descrizione: Non triggerano una release di default, a meno che non siano configurati esplicitamente nel commit-analyzer.
|
|
25
|
+
Esempio: chore: aggiorna dipendenze
|
|
26
|
+
|
|
27
|
+
5. Forzare una Release
|
|
28
|
+
Descrizione: Utile in caso di merge o altre operazioni.
|
|
29
|
+
Comandi:
|
|
30
|
+
git commit --allow-empty -m "feat: trigger test release"
|
|
31
|
+
Poi:
|
|
32
|
+
git push origin dev
|
|
33
|
+
Oppure:
|
|
34
|
+
git push origin main
|
package/dist/Utilities.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare class RestUtilities {
|
|
|
64
64
|
static sendErrorMessage(res: Response, error: any, tag?: string, status?: number): Response;
|
|
65
65
|
static sendUnauthorized(res: Response): Response;
|
|
66
66
|
static sendInvalidCredentials(res: Response): Response;
|
|
67
|
+
static sendPasswordExpired(res: Response): Response;
|
|
67
68
|
/**
|
|
68
69
|
* Sends a base response with a payload.
|
|
69
70
|
* @param res - Express Response object.
|
package/dist/Utilities.js
CHANGED
|
@@ -138,6 +138,14 @@ class RestUtilities {
|
|
|
138
138
|
message: "Credenziali non valide"
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
+
static sendPasswordExpired(res) {
|
|
142
|
+
return res.status(403).send({
|
|
143
|
+
severity: "warning",
|
|
144
|
+
statusCode: StatusCode.Warning,
|
|
145
|
+
code: "PASSWORD_EXPIRED",
|
|
146
|
+
message: "Password scaduta. E' necessario aggiornarla"
|
|
147
|
+
});
|
|
148
|
+
}
|
|
141
149
|
/**
|
|
142
150
|
* Sends a base response with a payload.
|
|
143
151
|
* @param res - Express Response object.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @module AccessiModule
|
|
5
5
|
* @author mttdev382
|
|
6
6
|
*/
|
|
7
|
-
import { Options } from
|
|
8
|
-
import { DynamicModule } from
|
|
7
|
+
import { Options } from 'es-node-firebird';
|
|
8
|
+
import { DynamicModule } from '@nestjs/common';
|
|
9
9
|
export interface JwtOptions {
|
|
10
10
|
secret: string;
|
|
11
11
|
expiresIn: string;
|
|
@@ -29,11 +29,20 @@ export interface ExtensionFieldsOptions {
|
|
|
29
29
|
}
|
|
30
30
|
export interface AccessiOptions {
|
|
31
31
|
databaseOptions: Options;
|
|
32
|
+
/**
|
|
33
|
+
* Basepath del sito es: 'http://www.il-mio-sito.it/nome-progetto(se c'è)'
|
|
34
|
+
*/
|
|
32
35
|
confirmationEmailUrl: string;
|
|
36
|
+
/**
|
|
37
|
+
* Percorso della pagina di reset personalizzata es. http://localhost:4200/#/admin/reset-password
|
|
38
|
+
* N.B si sostituisce al confirmationMailURl
|
|
39
|
+
*/
|
|
40
|
+
customResetPage?: string;
|
|
33
41
|
confirmationEmailReturnUrl: string;
|
|
34
42
|
confirmationEmailPrefix?: string;
|
|
35
43
|
encryptionKey: string;
|
|
36
44
|
mockDemoUser: boolean;
|
|
45
|
+
passwordExpiration?: boolean;
|
|
37
46
|
jwtOptions: JwtOptions;
|
|
38
47
|
emailOptions: EmailOptions;
|
|
39
48
|
extensionFieldsOptions?: ExtensionFieldsOptions[];
|
|
@@ -112,6 +112,10 @@ let AuthController = AuthController_1 = class AuthController {
|
|
|
112
112
|
return Utilities_1.RestUtilities.sendBaseResponse(res, userData);
|
|
113
113
|
}
|
|
114
114
|
catch (error) {
|
|
115
|
+
if (error.message === 'PASSWORD_EXPIRED') {
|
|
116
|
+
this.logger.warning('Password scaduta, cambiare password ', error);
|
|
117
|
+
return Utilities_1.RestUtilities.sendPasswordExpired(res);
|
|
118
|
+
}
|
|
115
119
|
this.logger.error('Errore durante il login', error);
|
|
116
120
|
return Utilities_1.RestUtilities.sendInvalidCredentials(res);
|
|
117
121
|
}
|
|
@@ -161,6 +165,20 @@ __decorate([
|
|
|
161
165
|
status: 401,
|
|
162
166
|
description: 'Credenziali non valide',
|
|
163
167
|
}),
|
|
168
|
+
(0, swagger_1.ApiResponse)({
|
|
169
|
+
status: 403,
|
|
170
|
+
description: "Password scaduta, è necessatio aggiornarla. ",
|
|
171
|
+
schema: {
|
|
172
|
+
example: {
|
|
173
|
+
message: {
|
|
174
|
+
severity: 'warning',
|
|
175
|
+
statusCode: 2, // o il valore di StatusCode.Warning
|
|
176
|
+
code: 'PASSWORD_EXPIRED',
|
|
177
|
+
message: 'Password scaduta. È necessario aggiornarla.',
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}),
|
|
164
182
|
(0, common_1.Post)('login'),
|
|
165
183
|
__param(0, (0, common_1.Body)()),
|
|
166
184
|
__param(1, (0, common_1.Res)()),
|
|
@@ -8,5 +8,6 @@ export declare class EmailController {
|
|
|
8
8
|
serveResetPasswordPage(res: Response, token: string, returnUrl?: string): Promise<void>;
|
|
9
9
|
sendPasswordResetEmail(request: Request, sendResetPasswordData: {
|
|
10
10
|
email: string;
|
|
11
|
+
htmlMail?: string;
|
|
11
12
|
}, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
12
13
|
}
|
|
@@ -41,7 +41,7 @@ let EmailController = EmailController_1 = class EmailController {
|
|
|
41
41
|
sendPasswordResetEmail(request, sendResetPasswordData, res) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
try {
|
|
44
|
-
yield this.emailService.sendPasswordResetEmail(sendResetPasswordData.email);
|
|
44
|
+
yield this.emailService.sendPasswordResetEmail(sendResetPasswordData.email, sendResetPasswordData.htmlMail);
|
|
45
45
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'email di reset è stata inoltrata al destinatario.");
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -52,9 +52,16 @@ let EmailController = EmailController_1 = class EmailController {
|
|
|
52
52
|
};
|
|
53
53
|
exports.EmailController = EmailController;
|
|
54
54
|
__decorate([
|
|
55
|
-
(0, swagger_1.ApiOperation)({
|
|
55
|
+
(0, swagger_1.ApiOperation)({
|
|
56
|
+
summary: 'Serve una pagina per il reset della password',
|
|
57
|
+
operationId: 'serveResetPasswordPage',
|
|
58
|
+
}),
|
|
56
59
|
(0, swagger_1.ApiParam)({ name: 'token', description: 'Token per il reset della password', required: true }),
|
|
57
|
-
(0, swagger_1.ApiQuery)({
|
|
60
|
+
(0, swagger_1.ApiQuery)({
|
|
61
|
+
name: 'returnUrl',
|
|
62
|
+
description: 'Url di ritorno della pagina. Default: https://google.com',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
58
65
|
(0, swagger_1.ApiResponse)({ status: 200, description: 'Pagina di reset password servita con successo' }),
|
|
59
66
|
(0, common_1.Get)('reset-password-page/:token'),
|
|
60
67
|
__param(0, (0, common_1.Res)()),
|
|
@@ -65,10 +72,30 @@ __decorate([
|
|
|
65
72
|
__metadata("design:returntype", Promise)
|
|
66
73
|
], EmailController.prototype, "serveResetPasswordPage", null);
|
|
67
74
|
__decorate([
|
|
68
|
-
(0, swagger_1.ApiOperation)({
|
|
69
|
-
|
|
75
|
+
(0, swagger_1.ApiOperation)({
|
|
76
|
+
summary: 'Invia una e-mail per il reset della password',
|
|
77
|
+
operationId: 'sendPasswordResetEmail',
|
|
78
|
+
}),
|
|
79
|
+
(0, swagger_1.ApiBody)({
|
|
80
|
+
schema: {
|
|
81
|
+
properties: {
|
|
82
|
+
email: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: "L'email dell'utente che richiede il reset",
|
|
85
|
+
},
|
|
86
|
+
htmlMail: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Corpo della mail in HTML',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ['email'],
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
70
94
|
(0, swagger_1.ApiResponse)({ status: 200, description: "L'email di reset è stata inviata con successo" }),
|
|
71
|
-
(0, swagger_1.ApiResponse)({
|
|
95
|
+
(0, swagger_1.ApiResponse)({
|
|
96
|
+
status: 400,
|
|
97
|
+
description: 'Errore nella richiesta: protocollo o host non impostati',
|
|
98
|
+
}),
|
|
72
99
|
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno durante l'invio dell'email" }),
|
|
73
100
|
(0, common_1.Post)('send-reset-password-email'),
|
|
74
101
|
__param(0, (0, common_1.Req)()),
|
|
@@ -4,6 +4,7 @@ import { UserService } from '../Services/UserService/UserService';
|
|
|
4
4
|
import { EmailService } from '../Services/EmailService/EmailService';
|
|
5
5
|
import { UserDto } from '../Dtos';
|
|
6
6
|
import { RegisterRequest } from '../Dtos/RegisterRequest';
|
|
7
|
+
import { SetStatoRegistrazioneDto } from '../Dtos/SetStatoRegistrazione';
|
|
7
8
|
export declare class UserController {
|
|
8
9
|
private readonly userService;
|
|
9
10
|
private readonly emailService;
|
|
@@ -13,6 +14,7 @@ export declare class UserController {
|
|
|
13
14
|
serveResetPasswordPage(res: Response, token: string): Promise<void>;
|
|
14
15
|
getUsers(res: Response, email?: string, codiceUtente?: number, includeExtensionFields?: boolean, includeGrants?: boolean): Promise<Response<any, Record<string, any>>>;
|
|
15
16
|
deleteUser(codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
17
|
+
setStatoRegistrazione(body: SetStatoRegistrazioneDto, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
16
18
|
register(request: Request, registrationData: RegisterRequest, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
17
19
|
updateUtente(codiceUtente: number, user: UserDto, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
18
20
|
setGdpr(codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
@@ -34,6 +34,7 @@ const Dtos_1 = require("../Dtos");
|
|
|
34
34
|
const RegisterResponse_1 = require("../Dtos/RegisterResponse");
|
|
35
35
|
const RegisterRequest_1 = require("../Dtos/RegisterRequest");
|
|
36
36
|
const Logger_1 = require("../../Logger");
|
|
37
|
+
const SetStatoRegistrazione_1 = require("../Dtos/SetStatoRegistrazione");
|
|
37
38
|
let UserController = UserController_1 = class UserController {
|
|
38
39
|
constructor(userService, emailService, options) {
|
|
39
40
|
this.userService = userService;
|
|
@@ -50,7 +51,10 @@ let UserController = UserController_1 = class UserController {
|
|
|
50
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
52
|
try {
|
|
52
53
|
let filters = { email, codiceUtente };
|
|
53
|
-
let options = {
|
|
54
|
+
let options = {
|
|
55
|
+
includeExtensionFields: includeExtensionFields !== null && includeExtensionFields !== void 0 ? includeExtensionFields : true,
|
|
56
|
+
includeGrants: includeGrants !== null && includeGrants !== void 0 ? includeGrants : true,
|
|
57
|
+
};
|
|
54
58
|
const users = yield this.userService.getUsers(filters, options);
|
|
55
59
|
return Utilities_1.RestUtilities.sendBaseResponse(res, users);
|
|
56
60
|
}
|
|
@@ -73,11 +77,27 @@ let UserController = UserController_1 = class UserController {
|
|
|
73
77
|
}
|
|
74
78
|
});
|
|
75
79
|
}
|
|
80
|
+
setStatoRegistrazione(body, res) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
try {
|
|
83
|
+
let { codiceUtente, statoRegistrazione } = body;
|
|
84
|
+
if (!codiceUtente)
|
|
85
|
+
throw new Error('Il codice utente è obbligatorio.');
|
|
86
|
+
if (statoRegistrazione === undefined)
|
|
87
|
+
throw new Error('Lo stato registrazione è obbligatorio.');
|
|
88
|
+
yield this.userService.setStato(codiceUtente, statoRegistrazione);
|
|
89
|
+
return Utilities_1.RestUtilities.sendOKMessage(res, `Lo stato dell'utente ${codiceUtente} è stato aggiornato a ${statoRegistrazione}.`);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, UserController_1.name);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
76
96
|
register(request, registrationData, res) {
|
|
77
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
98
|
try {
|
|
79
99
|
const codiceUtente = yield this.userService.register(registrationData);
|
|
80
|
-
yield this.emailService.sendPasswordResetEmail(registrationData.email);
|
|
100
|
+
yield this.emailService.sendPasswordResetEmail(registrationData.email, registrationData.htmlMail);
|
|
81
101
|
return Utilities_1.RestUtilities.sendBaseResponse(res, codiceUtente);
|
|
82
102
|
}
|
|
83
103
|
catch (error) {
|
|
@@ -89,7 +109,7 @@ let UserController = UserController_1 = class UserController {
|
|
|
89
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
110
|
try {
|
|
91
111
|
if (!codiceUtente)
|
|
92
|
-
throw new Error(
|
|
112
|
+
throw new Error('Il codice utente è obbligatorio.');
|
|
93
113
|
yield this.userService.updateUser(codiceUtente, user);
|
|
94
114
|
return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} è stato aggiornato con successo.`);
|
|
95
115
|
}
|
|
@@ -102,7 +122,7 @@ let UserController = UserController_1 = class UserController {
|
|
|
102
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
123
|
try {
|
|
104
124
|
if (!codiceUtente)
|
|
105
|
-
throw new Error(
|
|
125
|
+
throw new Error('Il codice utente è obbligatorio.');
|
|
106
126
|
yield this.userService.setGdpr(codiceUtente);
|
|
107
127
|
return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} ha accettato il GDPR.`);
|
|
108
128
|
}
|
|
@@ -114,8 +134,15 @@ let UserController = UserController_1 = class UserController {
|
|
|
114
134
|
};
|
|
115
135
|
exports.UserController = UserController;
|
|
116
136
|
__decorate([
|
|
117
|
-
(0, swagger_1.ApiOperation)({
|
|
118
|
-
|
|
137
|
+
(0, swagger_1.ApiOperation)({
|
|
138
|
+
summary: 'Servire la pagina di reset password',
|
|
139
|
+
operationId: 'serveResetPasswordPageUser',
|
|
140
|
+
}),
|
|
141
|
+
(0, swagger_1.ApiParam)({
|
|
142
|
+
name: 'token',
|
|
143
|
+
description: 'Token per il reset della password',
|
|
144
|
+
required: true,
|
|
145
|
+
}),
|
|
119
146
|
(0, common_1.Get)('reset-password/:token'),
|
|
120
147
|
__param(0, (0, common_1.Res)()),
|
|
121
148
|
__param(1, (0, common_1.Param)('token')),
|
|
@@ -124,13 +151,36 @@ __decorate([
|
|
|
124
151
|
__metadata("design:returntype", Promise)
|
|
125
152
|
], UserController.prototype, "serveResetPasswordPage", null);
|
|
126
153
|
__decorate([
|
|
127
|
-
(0, swagger_1.ApiOperation)({
|
|
128
|
-
|
|
154
|
+
(0, swagger_1.ApiOperation)({
|
|
155
|
+
summary: 'Recupera la lista degli utenti',
|
|
156
|
+
operationId: 'getUsers',
|
|
157
|
+
}),
|
|
158
|
+
(0, swagger_1.ApiResponse)({
|
|
159
|
+
status: 200,
|
|
160
|
+
description: 'Lista utenti recuperata con successo',
|
|
161
|
+
type: GetUsersResponse_1.GetUsersResponse,
|
|
162
|
+
}),
|
|
129
163
|
(0, swagger_1.ApiResponse)({ status: 401, description: 'Credenziali non valide' }),
|
|
130
|
-
(0, swagger_1.ApiQuery)({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
164
|
+
(0, swagger_1.ApiQuery)({
|
|
165
|
+
name: 'email',
|
|
166
|
+
required: false,
|
|
167
|
+
description: "Email dell'utente da cercare",
|
|
168
|
+
}),
|
|
169
|
+
(0, swagger_1.ApiQuery)({
|
|
170
|
+
name: 'codiceUtente',
|
|
171
|
+
required: false,
|
|
172
|
+
description: "Codice dell'utente da cercare",
|
|
173
|
+
}),
|
|
174
|
+
(0, swagger_1.ApiQuery)({
|
|
175
|
+
name: 'includeExtensionFields',
|
|
176
|
+
required: false,
|
|
177
|
+
description: 'Includi extension fields (chiamata più pesante)',
|
|
178
|
+
}),
|
|
179
|
+
(0, swagger_1.ApiQuery)({
|
|
180
|
+
name: 'includeGrants',
|
|
181
|
+
required: false,
|
|
182
|
+
description: 'Includi Permessi (chiamata più pesante)',
|
|
183
|
+
}),
|
|
134
184
|
(0, common_1.Get)('get-users'),
|
|
135
185
|
__param(0, (0, common_1.Res)()),
|
|
136
186
|
__param(1, (0, common_1.Query)('email')),
|
|
@@ -142,16 +192,24 @@ __decorate([
|
|
|
142
192
|
__metadata("design:returntype", Promise)
|
|
143
193
|
], UserController.prototype, "getUsers", null);
|
|
144
194
|
__decorate([
|
|
145
|
-
(0, swagger_1.ApiOperation)({
|
|
195
|
+
(0, swagger_1.ApiOperation)({
|
|
196
|
+
summary: 'Elimina un utente',
|
|
197
|
+
operationId: 'deleteUser',
|
|
198
|
+
description: `Imposta lo stato di un utente a 50(eliminato)
|
|
199
|
+
Non esegue una eliminazione dei record`,
|
|
200
|
+
}),
|
|
146
201
|
(0, swagger_1.ApiParam)({
|
|
147
202
|
name: 'codiceUtente',
|
|
148
203
|
description: "Codice identificativo dell'utente da eliminare",
|
|
149
204
|
required: true,
|
|
150
|
-
example:
|
|
205
|
+
example: 'USR123',
|
|
206
|
+
}),
|
|
207
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Utente eliminato con successo' }),
|
|
208
|
+
(0, swagger_1.ApiResponse)({
|
|
209
|
+
status: 400,
|
|
210
|
+
description: 'Errore nei parametri della richiesta',
|
|
151
211
|
}),
|
|
152
|
-
(0, swagger_1.ApiResponse)({ status:
|
|
153
|
-
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nei parametri della richiesta" }),
|
|
154
|
-
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
212
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: 'Errore interno del server' }),
|
|
155
213
|
(0, common_1.Delete)('delete-user/:codiceUtente'),
|
|
156
214
|
__param(0, (0, common_1.Param)('codiceUtente')),
|
|
157
215
|
__param(1, (0, common_1.Res)()),
|
|
@@ -159,6 +217,38 @@ __decorate([
|
|
|
159
217
|
__metadata("design:paramtypes", [Number, Object]),
|
|
160
218
|
__metadata("design:returntype", Promise)
|
|
161
219
|
], UserController.prototype, "deleteUser", null);
|
|
220
|
+
__decorate([
|
|
221
|
+
(0, swagger_1.ApiOperation)({
|
|
222
|
+
summary: 'Imposta lo stato di registrazione di un utente',
|
|
223
|
+
operationId: 'setStatoRegistrazione',
|
|
224
|
+
description: `Imposta lo stato di registrazione di un utente. Stati possibili:
|
|
225
|
+
- 0: NULL (non definito)
|
|
226
|
+
- 5: INSERT (inserito)
|
|
227
|
+
- 10: INVIO (inviato)
|
|
228
|
+
- 20: CONF (confermato)
|
|
229
|
+
- 50: DELETE (eliminato)
|
|
230
|
+
- 99: BLOCC (bloccato)`,
|
|
231
|
+
}),
|
|
232
|
+
(0, swagger_1.ApiResponse)({
|
|
233
|
+
status: 200,
|
|
234
|
+
description: 'Stato registrazione aggiornato con successo',
|
|
235
|
+
}),
|
|
236
|
+
(0, swagger_1.ApiResponse)({
|
|
237
|
+
status: 400,
|
|
238
|
+
description: 'Errore nei parametri della richiesta',
|
|
239
|
+
}),
|
|
240
|
+
(0, swagger_1.ApiResponse)({
|
|
241
|
+
status: 500,
|
|
242
|
+
description: 'Errore interno del server',
|
|
243
|
+
}),
|
|
244
|
+
(0, swagger_1.ApiBody)({ type: SetStatoRegistrazione_1.SetStatoRegistrazioneDto }),
|
|
245
|
+
(0, common_1.Post)('set-stato'),
|
|
246
|
+
__param(0, (0, common_1.Body)()),
|
|
247
|
+
__param(1, (0, common_1.Res)()),
|
|
248
|
+
__metadata("design:type", Function),
|
|
249
|
+
__metadata("design:paramtypes", [SetStatoRegistrazione_1.SetStatoRegistrazioneDto, Object]),
|
|
250
|
+
__metadata("design:returntype", Promise)
|
|
251
|
+
], UserController.prototype, "setStatoRegistrazione", null);
|
|
162
252
|
__decorate([
|
|
163
253
|
(0, swagger_1.ApiOperation)({
|
|
164
254
|
summary: 'Registra un nuovo utente',
|
|
@@ -166,19 +256,19 @@ __decorate([
|
|
|
166
256
|
}),
|
|
167
257
|
(0, swagger_1.ApiBody)({
|
|
168
258
|
type: RegisterRequest_1.RegisterRequest,
|
|
169
|
-
description: "Dati necessari per la registrazione dell'utente"
|
|
259
|
+
description: "Dati necessari per la registrazione dell'utente",
|
|
170
260
|
}),
|
|
171
261
|
(0, swagger_1.ApiCreatedResponse)({
|
|
172
262
|
description: 'Utente registrato con successo. Restituisce il codice utente e invia una mail di conferma/reset password.',
|
|
173
|
-
type: RegisterResponse_1.RegisterResponse
|
|
263
|
+
type: RegisterResponse_1.RegisterResponse,
|
|
174
264
|
}),
|
|
175
265
|
(0, swagger_1.ApiResponse)({
|
|
176
266
|
status: common_1.HttpStatus.BAD_REQUEST,
|
|
177
|
-
description: 'Errore nella registrazione. Potrebbe essere dovuto a dati mancanti, email già esistente o configurazione non valida.'
|
|
267
|
+
description: 'Errore nella registrazione. Potrebbe essere dovuto a dati mancanti, email già esistente o configurazione non valida.',
|
|
178
268
|
}),
|
|
179
269
|
(0, swagger_1.ApiResponse)({
|
|
180
270
|
status: common_1.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
181
|
-
description: 'Errore interno del server durante la registrazione o l’invio dell’email.'
|
|
271
|
+
description: 'Errore interno del server durante la registrazione o l’invio dell’email.',
|
|
182
272
|
}),
|
|
183
273
|
(0, common_1.Post)('register'),
|
|
184
274
|
__param(0, (0, common_1.Req)()),
|
|
@@ -189,18 +279,24 @@ __decorate([
|
|
|
189
279
|
__metadata("design:returntype", Promise)
|
|
190
280
|
], UserController.prototype, "register", null);
|
|
191
281
|
__decorate([
|
|
192
|
-
(0, swagger_1.ApiOperation)({
|
|
282
|
+
(0, swagger_1.ApiOperation)({
|
|
283
|
+
summary: 'Aggiorna un utente esistente',
|
|
284
|
+
operationId: 'updateUtente',
|
|
285
|
+
}),
|
|
193
286
|
(0, swagger_1.ApiParam)({
|
|
194
287
|
name: 'codiceUtente',
|
|
195
288
|
description: "Codice identificativo dell'utente da aggiornare",
|
|
196
289
|
required: true,
|
|
197
|
-
example:
|
|
290
|
+
example: 'USR123',
|
|
198
291
|
}),
|
|
199
292
|
(0, swagger_1.ApiBody)({
|
|
200
293
|
type: Dtos_1.UserDto,
|
|
201
|
-
description: "Dati aggiornati dell'utente (escluso il codice utente, che è nel path)"
|
|
294
|
+
description: "Dati aggiornati dell'utente (escluso il codice utente, che è nel path)",
|
|
295
|
+
}),
|
|
296
|
+
(0, swagger_1.ApiResponse)({
|
|
297
|
+
status: common_1.HttpStatus.OK,
|
|
298
|
+
description: 'Utente aggiornato con successo',
|
|
202
299
|
}),
|
|
203
|
-
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.OK, description: "Utente aggiornato con successo" }),
|
|
204
300
|
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nell'aggiornamento" }),
|
|
205
301
|
(0, common_1.Put)('update-user/:codiceUtente'),
|
|
206
302
|
__param(0, (0, common_1.Param)('codiceUtente')),
|
|
@@ -211,15 +307,21 @@ __decorate([
|
|
|
211
307
|
__metadata("design:returntype", Promise)
|
|
212
308
|
], UserController.prototype, "updateUtente", null);
|
|
213
309
|
__decorate([
|
|
214
|
-
(0, swagger_1.ApiOperation)({
|
|
310
|
+
(0, swagger_1.ApiOperation)({
|
|
311
|
+
summary: 'Imposta il consenso GDPR per un utente',
|
|
312
|
+
operationId: 'setGdpr',
|
|
313
|
+
}),
|
|
215
314
|
(0, swagger_1.ApiParam)({
|
|
216
|
-
name:
|
|
315
|
+
name: 'codiceUtente',
|
|
217
316
|
description: "Codice identificativo dell'utente che accetta il GDPR",
|
|
218
317
|
required: true,
|
|
219
|
-
example:
|
|
318
|
+
example: 'USR123',
|
|
319
|
+
}),
|
|
320
|
+
(0, swagger_1.ApiResponse)({
|
|
321
|
+
status: 200,
|
|
322
|
+
description: 'Consenso GDPR impostato con successo',
|
|
220
323
|
}),
|
|
221
|
-
(0, swagger_1.ApiResponse)({ status:
|
|
222
|
-
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nella richiesta" }),
|
|
324
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: 'Errore nella richiesta' }),
|
|
223
325
|
(0, common_1.Patch)('set-gdpr/:codiceUtente'),
|
|
224
326
|
__param(0, (0, common_1.Param)('codiceUtente')),
|
|
225
327
|
__param(1, (0, common_1.Res)()),
|
|
@@ -3,8 +3,9 @@ export declare class FiltriUtente {
|
|
|
3
3
|
numeroReport?: number;
|
|
4
4
|
indicePersonale?: number;
|
|
5
5
|
codiceClienteSuper?: string | null;
|
|
6
|
-
|
|
6
|
+
codAge?: number;
|
|
7
7
|
codiceClienteCollegato?: string;
|
|
8
8
|
codiceClienti?: string;
|
|
9
|
-
tipoFiltro?:
|
|
9
|
+
tipoFiltro?: number;
|
|
10
|
+
idxPostazione?: number;
|
|
10
11
|
}
|
|
@@ -51,13 +51,13 @@ __decorate([
|
|
|
51
51
|
], FiltriUtente.prototype, "codiceClienteSuper", void 0);
|
|
52
52
|
__decorate([
|
|
53
53
|
(0, swagger_1.ApiPropertyOptional)({
|
|
54
|
-
description: 'Codice dell\'
|
|
55
|
-
example:
|
|
54
|
+
description: 'Codice dell\'agente associato',
|
|
55
|
+
example: 1
|
|
56
56
|
}),
|
|
57
|
-
(0, class_validator_1.
|
|
57
|
+
(0, class_validator_1.IsNumber)(),
|
|
58
58
|
(0, class_validator_1.IsOptional)(),
|
|
59
|
-
__metadata("design:type",
|
|
60
|
-
], FiltriUtente.prototype, "
|
|
59
|
+
__metadata("design:type", Number)
|
|
60
|
+
], FiltriUtente.prototype, "codAge", void 0);
|
|
61
61
|
__decorate([
|
|
62
62
|
(0, swagger_1.ApiPropertyOptional)({
|
|
63
63
|
description: 'Codice del cliente collegato',
|
|
@@ -83,5 +83,9 @@ __decorate([
|
|
|
83
83
|
}),
|
|
84
84
|
(0, class_validator_1.IsString)(),
|
|
85
85
|
(0, class_validator_1.IsOptional)(),
|
|
86
|
-
__metadata("design:type",
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
87
|
], FiltriUtente.prototype, "tipoFiltro", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "idx della postazione nella tabella ANTENNE_POS di PROLAV", example: "12" }),
|
|
90
|
+
__metadata("design:type", Number)
|
|
91
|
+
], FiltriUtente.prototype, "idxPostazione", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Permission } from
|
|
1
|
+
import { Permission } from "./Permission";
|
|
2
2
|
export declare class RegisterRequest {
|
|
3
3
|
email: string;
|
|
4
4
|
cognome?: string;
|
|
@@ -9,13 +9,15 @@ export declare class RegisterRequest {
|
|
|
9
9
|
permissions?: Permission[];
|
|
10
10
|
numeroReport?: number;
|
|
11
11
|
indicePersonale?: number;
|
|
12
|
-
codiceClienteSuper?:
|
|
13
|
-
|
|
14
|
-
codiceClienteCollegato?:
|
|
12
|
+
codiceClienteSuper?: number;
|
|
13
|
+
codAge?: number;
|
|
14
|
+
codiceClienteCollegato?: number;
|
|
15
15
|
codiceClienti?: string;
|
|
16
|
-
tipoFiltro?:
|
|
16
|
+
tipoFiltro?: number;
|
|
17
17
|
avatar?: string;
|
|
18
18
|
flagDueFattori?: boolean;
|
|
19
19
|
paginaDefault?: string;
|
|
20
20
|
ragSocCli?: string;
|
|
21
|
+
htmlMail?: string;
|
|
22
|
+
idxPostazione?: number;
|
|
21
23
|
}
|