emilsoftware-utilities 1.5.0-dev.1 → 1.5.0-dev.3
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/AccessiModule.js +7 -4
- package/dist/accessi-module/Controllers/FiltriController.d.ts +12 -0
- package/dist/accessi-module/Controllers/FiltriController.js +138 -0
- package/dist/accessi-module/Dtos/FiltriUtente.d.ts +58 -7
- package/dist/accessi-module/Dtos/FiltriUtente.js +84 -29
- package/dist/accessi-module/Dtos/RegisterRequest.d.ts +4 -9
- package/dist/accessi-module/Dtos/RegisterRequest.js +2 -57
- package/dist/accessi-module/Dtos/TipoFiltro.d.ts +13 -0
- package/dist/accessi-module/Dtos/TipoFiltro.js +90 -0
- package/dist/accessi-module/Dtos/UserDto.d.ts +4 -10
- package/dist/accessi-module/Dtos/UserDto.js +2 -40
- package/dist/accessi-module/Services/AuthService/AuthService.d.ts +3 -1
- package/dist/accessi-module/Services/AuthService/AuthService.js +7 -4
- package/dist/accessi-module/Services/FiltriService/FiltriService.d.ts +11 -0
- package/dist/accessi-module/Services/FiltriService/FiltriService.js +126 -0
- package/dist/accessi-module/Services/UserService/UserService.d.ts +3 -3
- package/dist/accessi-module/Services/UserService/UserService.js +32 -27
- package/dist/emilsoftware-utilities-1.5.0-dev.3.tgz +0 -0
- package/package.json +1 -1
- package/dist/emilsoftware-utilities-1.5.0-dev.1.tgz +0 -0
|
@@ -17,6 +17,8 @@ const EmailController_1 = require("./Controllers/EmailController");
|
|
|
17
17
|
const AuthController_1 = require("./Controllers/AuthController");
|
|
18
18
|
const PermissionController_1 = require("./Controllers/PermissionController");
|
|
19
19
|
const UserController_1 = require("./Controllers/UserController");
|
|
20
|
+
const FiltriService_1 = require("./Services/FiltriService/FiltriService");
|
|
21
|
+
const FiltriController_1 = require("./Controllers/FiltriController");
|
|
20
22
|
let AccessiModule = AccessiModule_1 = class AccessiModule {
|
|
21
23
|
static forRoot(options) {
|
|
22
24
|
return {
|
|
@@ -30,8 +32,9 @@ let AccessiModule = AccessiModule_1 = class AccessiModule {
|
|
|
30
32
|
UserService_1.UserService,
|
|
31
33
|
EmailService_1.EmailService,
|
|
32
34
|
PermissionService_1.PermissionService,
|
|
35
|
+
FiltriService_1.FiltriService
|
|
33
36
|
],
|
|
34
|
-
exports: ['ACCESSI_OPTIONS', AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService],
|
|
37
|
+
exports: ['ACCESSI_OPTIONS', AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService, FiltriService_1.FiltriService],
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
};
|
|
@@ -39,8 +42,8 @@ exports.AccessiModule = AccessiModule;
|
|
|
39
42
|
exports.AccessiModule = AccessiModule = AccessiModule_1 = __decorate([
|
|
40
43
|
(0, common_1.Global)(),
|
|
41
44
|
(0, common_1.Module)({
|
|
42
|
-
controllers: [EmailController_1.EmailController, AuthController_1.AuthController, PermissionController_1.PermissionController, UserController_1.UserController],
|
|
43
|
-
providers: [AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService],
|
|
44
|
-
exports: [AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService],
|
|
45
|
+
controllers: [EmailController_1.EmailController, AuthController_1.AuthController, PermissionController_1.PermissionController, UserController_1.UserController, FiltriController_1.FiltriController],
|
|
46
|
+
providers: [AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService, FiltriService_1.FiltriService],
|
|
47
|
+
exports: [AuthService_1.AuthService, UserService_1.UserService, EmailService_1.EmailService, PermissionService_1.PermissionService, FiltriService_1.FiltriService],
|
|
45
48
|
})
|
|
46
49
|
], AccessiModule);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { AccessiOptions } from '../AccessiModule';
|
|
3
|
+
import { FiltriUtente, GetFiltriUtenteRequest } from '../Dtos';
|
|
4
|
+
import { FiltriService } from '../Services/FiltriService/FiltriService';
|
|
5
|
+
export declare class FiltriController {
|
|
6
|
+
private readonly filtriService;
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(filtriService: FiltriService, options: AccessiOptions);
|
|
9
|
+
getTipoFiltri(res: Response): Promise<Response<any, Record<string, any>>>;
|
|
10
|
+
getFiltriUtente(res: Response, req: GetFiltriUtenteRequest): Promise<Response<any, Record<string, any>>>;
|
|
11
|
+
saveFiltriUtente(res: Response, req: FiltriUtente): Promise<Response<any, Record<string, any>>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var FiltriController_1;
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.FiltriController = void 0;
|
|
26
|
+
const common_1 = require("@nestjs/common");
|
|
27
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
28
|
+
const Utilities_1 = require("../../Utilities");
|
|
29
|
+
const Dtos_1 = require("../Dtos");
|
|
30
|
+
const TipoFiltro_1 = require("../Dtos/TipoFiltro");
|
|
31
|
+
const FiltriService_1 = require("../Services/FiltriService/FiltriService");
|
|
32
|
+
let FiltriController = FiltriController_1 = class FiltriController {
|
|
33
|
+
constructor(filtriService, options) {
|
|
34
|
+
this.filtriService = filtriService;
|
|
35
|
+
this.options = options;
|
|
36
|
+
}
|
|
37
|
+
getTipoFiltri(res) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const response = yield this.filtriService.getTipoFiltri();
|
|
41
|
+
return Utilities_1.RestUtilities.sendBaseResponse(res, response);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, FiltriController_1.name);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getFiltriUtente(res, req) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
try {
|
|
51
|
+
let { codUte } = req;
|
|
52
|
+
const response = yield this.filtriService.getFiltriUser(codUte);
|
|
53
|
+
return Utilities_1.RestUtilities.sendBaseResponse(res, response);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, FiltriController_1.name);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
saveFiltriUtente(res, req) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
try {
|
|
63
|
+
const response = yield this.filtriService.upsertFiltriUtente(req.codUte, req);
|
|
64
|
+
return Utilities_1.RestUtilities.sendOKMessage(res, `Aggiornamento filtri per l'utente ${req.codUte} effettuato correttamente`);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return Utilities_1.RestUtilities.sendErrorMessage(res, error, FiltriController_1.name);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.FiltriController = FiltriController;
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, common_1.Get)('tipi'),
|
|
75
|
+
(0, swagger_1.ApiOperation)({
|
|
76
|
+
operationId: 'getTipiFiltro',
|
|
77
|
+
summary: 'Recupera la lista dei tipi di filtri',
|
|
78
|
+
description: 'Ritorna tutti i tipi di filtri disponibili nel sistema',
|
|
79
|
+
}),
|
|
80
|
+
(0, swagger_1.ApiResponse)({
|
|
81
|
+
status: 200,
|
|
82
|
+
description: 'Lista dei tipi di filtri recuperata con successo',
|
|
83
|
+
type: TipoFiltro_1.GetFiltriResponse,
|
|
84
|
+
}),
|
|
85
|
+
(0, swagger_1.ApiResponse)({
|
|
86
|
+
status: 500,
|
|
87
|
+
description: 'Errore interno durante il recupero dei tipi di filtri',
|
|
88
|
+
}),
|
|
89
|
+
__param(0, (0, common_1.Res)()),
|
|
90
|
+
__metadata("design:type", Function),
|
|
91
|
+
__metadata("design:paramtypes", [Object]),
|
|
92
|
+
__metadata("design:returntype", Promise)
|
|
93
|
+
], FiltriController.prototype, "getTipoFiltri", null);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, common_1.Get)('utente'),
|
|
96
|
+
(0, swagger_1.ApiOperation)({
|
|
97
|
+
operationId: 'getFiltriUtente',
|
|
98
|
+
summary: 'Recupera i filtri di un utente',
|
|
99
|
+
description: 'Ritorna tutti i filtri associati ad un utente specifico',
|
|
100
|
+
}),
|
|
101
|
+
(0, swagger_1.ApiResponse)({
|
|
102
|
+
status: 200,
|
|
103
|
+
description: 'Lista dei filtri dell’utente recuperata con successo',
|
|
104
|
+
type: Dtos_1.GetFiltriUtenteResponse,
|
|
105
|
+
}),
|
|
106
|
+
__param(0, (0, common_1.Res)()),
|
|
107
|
+
__param(1, (0, common_1.Query)()),
|
|
108
|
+
__metadata("design:type", Function),
|
|
109
|
+
__metadata("design:paramtypes", [Object, Dtos_1.GetFiltriUtenteRequest]),
|
|
110
|
+
__metadata("design:returntype", Promise)
|
|
111
|
+
], FiltriController.prototype, "getFiltriUtente", null);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, common_1.Post)('utente'),
|
|
114
|
+
(0, swagger_1.ApiOperation)({
|
|
115
|
+
operationId: 'saveFiltriUtente',
|
|
116
|
+
summary: 'Inserisce o aggiorna i filtri di un utente',
|
|
117
|
+
description: 'Permette di salvare (inserire o aggiornare) i filtri associati ad un utente specifico'
|
|
118
|
+
}),
|
|
119
|
+
(0, swagger_1.ApiResponse)({
|
|
120
|
+
status: 200,
|
|
121
|
+
description: 'Filtri utente salvati con successo'
|
|
122
|
+
}),
|
|
123
|
+
(0, swagger_1.ApiResponse)({
|
|
124
|
+
status: 500,
|
|
125
|
+
description: 'Errore interno durante il salvataggio dei filtri utente',
|
|
126
|
+
}),
|
|
127
|
+
__param(0, (0, common_1.Res)()),
|
|
128
|
+
__param(1, (0, common_1.Body)()),
|
|
129
|
+
__metadata("design:type", Function),
|
|
130
|
+
__metadata("design:paramtypes", [Object, Dtos_1.FiltriUtente]),
|
|
131
|
+
__metadata("design:returntype", Promise)
|
|
132
|
+
], FiltriController.prototype, "saveFiltriUtente", null);
|
|
133
|
+
exports.FiltriController = FiltriController = FiltriController_1 = __decorate([
|
|
134
|
+
(0, swagger_1.ApiTags)('Filtri'),
|
|
135
|
+
(0, common_1.Controller)('accessi/filtri'),
|
|
136
|
+
__param(1, (0, common_1.Inject)('ACCESSI_OPTIONS')),
|
|
137
|
+
__metadata("design:paramtypes", [FiltriService_1.FiltriService, Object])
|
|
138
|
+
], FiltriController);
|
|
@@ -1,11 +1,62 @@
|
|
|
1
|
+
import { BaseResponse } from './BaseResponse';
|
|
1
2
|
export declare class FiltriUtente {
|
|
3
|
+
codUte: number;
|
|
2
4
|
progressivo?: number;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
numRep?: number;
|
|
6
|
+
idxPers?: number;
|
|
7
|
+
codCliSuper?: number;
|
|
6
8
|
codAge?: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
codCliCol?: number;
|
|
10
|
+
codClienti?: string;
|
|
11
|
+
tipFil?: number;
|
|
12
|
+
idxPos?: number;
|
|
13
|
+
codDip?: number;
|
|
11
14
|
}
|
|
15
|
+
export declare class GetFiltriUtenteResponse extends BaseResponse {
|
|
16
|
+
Result: FiltriUtente[];
|
|
17
|
+
}
|
|
18
|
+
export declare class GetFiltriUtenteRequest {
|
|
19
|
+
codUte?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const FILTRI_UTENTE_DB_MAPPING: {
|
|
22
|
+
readonly progressivo: {
|
|
23
|
+
readonly dbField: "PROG";
|
|
24
|
+
readonly numeric: true;
|
|
25
|
+
};
|
|
26
|
+
readonly numRep: {
|
|
27
|
+
readonly dbField: "NUMREP";
|
|
28
|
+
readonly numeric: true;
|
|
29
|
+
};
|
|
30
|
+
readonly idxPers: {
|
|
31
|
+
readonly dbField: "IDXPERS";
|
|
32
|
+
readonly numeric: true;
|
|
33
|
+
};
|
|
34
|
+
readonly codCliSuper: {
|
|
35
|
+
readonly dbField: "CODCLISUPER";
|
|
36
|
+
readonly numeric: true;
|
|
37
|
+
};
|
|
38
|
+
readonly codAge: {
|
|
39
|
+
readonly dbField: "CODAGE";
|
|
40
|
+
readonly numeric: true;
|
|
41
|
+
};
|
|
42
|
+
readonly codCliCol: {
|
|
43
|
+
readonly dbField: "CODCLICOL";
|
|
44
|
+
readonly numeric: true;
|
|
45
|
+
};
|
|
46
|
+
readonly codClienti: {
|
|
47
|
+
readonly dbField: "CODCLIENTI";
|
|
48
|
+
readonly numeric: false;
|
|
49
|
+
};
|
|
50
|
+
readonly tipFil: {
|
|
51
|
+
readonly dbField: "TIPFIL";
|
|
52
|
+
readonly numeric: true;
|
|
53
|
+
};
|
|
54
|
+
readonly idxPos: {
|
|
55
|
+
readonly dbField: "IDXPOS";
|
|
56
|
+
readonly numeric: true;
|
|
57
|
+
};
|
|
58
|
+
readonly codDip: {
|
|
59
|
+
readonly dbField: "CODDIP";
|
|
60
|
+
readonly numeric: true;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -9,46 +9,57 @@ 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.FiltriUtente = void 0;
|
|
12
|
+
exports.FILTRI_UTENTE_DB_MAPPING = exports.GetFiltriUtenteRequest = exports.GetFiltriUtenteResponse = exports.FiltriUtente = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
const class_validator_1 = require("class-validator");
|
|
16
|
+
const BaseResponse_1 = require("./BaseResponse");
|
|
15
17
|
class FiltriUtente {
|
|
16
18
|
}
|
|
17
19
|
exports.FiltriUtente = FiltriUtente;
|
|
18
20
|
__decorate([
|
|
19
21
|
(0, swagger_1.ApiProperty)({
|
|
20
|
-
description: '
|
|
22
|
+
description: 'Codice dell\'utente',
|
|
21
23
|
example: 1
|
|
22
24
|
}),
|
|
23
|
-
(
|
|
24
|
-
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], FiltriUtente.prototype, "codUte", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
29
|
+
description: 'Progressivo identificativo del filtro',
|
|
30
|
+
example: 1,
|
|
31
|
+
}),
|
|
32
|
+
(0, class_validator_1.IsInt)({ message: 'Il progressivo deve essere un numero intero.' }),
|
|
33
|
+
(0, class_validator_1.Min)(1, { message: 'Il progressivo deve essere maggiore di 0.' }),
|
|
25
34
|
__metadata("design:type", Number)
|
|
26
35
|
], FiltriUtente.prototype, "progressivo", void 0);
|
|
27
36
|
__decorate([
|
|
28
|
-
(0, swagger_1.
|
|
29
|
-
description: 'Numero del
|
|
30
|
-
example: 1002
|
|
37
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
38
|
+
description: 'Numero del reparto associato',
|
|
39
|
+
example: 1002,
|
|
31
40
|
}),
|
|
32
|
-
(0, class_validator_1.IsInt)({ message:
|
|
41
|
+
(0, class_validator_1.IsInt)({ message: 'Il numero del reparto deve essere un numero intero.' }),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
43
|
__metadata("design:type", Number)
|
|
34
|
-
], FiltriUtente.prototype, "
|
|
44
|
+
], FiltriUtente.prototype, "numRep", void 0);
|
|
35
45
|
__decorate([
|
|
36
|
-
(0, swagger_1.
|
|
37
|
-
description: '
|
|
38
|
-
example: 15
|
|
46
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
47
|
+
description: 'Idx personale',
|
|
48
|
+
example: 15,
|
|
39
49
|
}),
|
|
40
50
|
(0, class_validator_1.IsInt)({ message: "L'indice personale deve essere un numero intero." }),
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
52
|
__metadata("design:type", Number)
|
|
42
|
-
], FiltriUtente.prototype, "
|
|
53
|
+
], FiltriUtente.prototype, "idxPers", void 0);
|
|
43
54
|
__decorate([
|
|
44
55
|
(0, swagger_1.ApiPropertyOptional)({
|
|
45
|
-
description: 'Codice
|
|
46
|
-
example:
|
|
56
|
+
description: 'Codice Cliente padre (codcli di esgest)',
|
|
57
|
+
example: 1,
|
|
47
58
|
}),
|
|
48
|
-
(0, class_validator_1.
|
|
59
|
+
(0, class_validator_1.IsNumber)(),
|
|
49
60
|
(0, class_validator_1.IsOptional)(),
|
|
50
|
-
__metadata("design:type",
|
|
51
|
-
], FiltriUtente.prototype, "
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], FiltriUtente.prototype, "codCliSuper", void 0);
|
|
52
63
|
__decorate([
|
|
53
64
|
(0, swagger_1.ApiPropertyOptional)({
|
|
54
65
|
description: 'Codice dell\'agente associato',
|
|
@@ -61,31 +72,75 @@ __decorate([
|
|
|
61
72
|
__decorate([
|
|
62
73
|
(0, swagger_1.ApiPropertyOptional)({
|
|
63
74
|
description: 'Codice del cliente collegato',
|
|
64
|
-
example:
|
|
75
|
+
example: 1,
|
|
65
76
|
}),
|
|
66
|
-
(0, class_validator_1.
|
|
77
|
+
(0, class_validator_1.IsNumber)(),
|
|
67
78
|
(0, class_validator_1.IsOptional)(),
|
|
68
|
-
__metadata("design:type",
|
|
69
|
-
], FiltriUtente.prototype, "
|
|
79
|
+
__metadata("design:type", Number)
|
|
80
|
+
], FiltriUtente.prototype, "codCliCol", void 0);
|
|
70
81
|
__decorate([
|
|
71
82
|
(0, swagger_1.ApiPropertyOptional)({
|
|
72
83
|
description: 'Lista di codici clienti separati da virgola',
|
|
73
|
-
example: '
|
|
84
|
+
example: '123,456,789',
|
|
74
85
|
}),
|
|
75
86
|
(0, class_validator_1.IsString)(),
|
|
76
87
|
(0, class_validator_1.IsOptional)(),
|
|
77
88
|
__metadata("design:type", String)
|
|
78
|
-
], FiltriUtente.prototype, "
|
|
89
|
+
], FiltriUtente.prototype, "codClienti", void 0);
|
|
79
90
|
__decorate([
|
|
80
91
|
(0, swagger_1.ApiPropertyOptional)({
|
|
81
92
|
description: 'Tipo di filtro applicato',
|
|
82
|
-
example:
|
|
93
|
+
example: 99,
|
|
83
94
|
}),
|
|
84
|
-
(0, class_validator_1.
|
|
95
|
+
(0, class_validator_1.IsNumber)(),
|
|
96
|
+
(0, class_validator_1.IsOptional)(),
|
|
97
|
+
__metadata("design:type", Number)
|
|
98
|
+
], FiltriUtente.prototype, "tipFil", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
101
|
+
description: 'idx della postazione nella tabella ANTENNE_POS di PROLAV',
|
|
102
|
+
example: 12,
|
|
103
|
+
}),
|
|
104
|
+
__metadata("design:type", Number)
|
|
105
|
+
], FiltriUtente.prototype, "idxPos", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
108
|
+
description: 'Codice dipendente di esgest',
|
|
109
|
+
example: 12
|
|
110
|
+
}),
|
|
111
|
+
(0, class_validator_1.IsNumber)(),
|
|
85
112
|
(0, class_validator_1.IsOptional)(),
|
|
86
113
|
__metadata("design:type", Number)
|
|
87
|
-
], FiltriUtente.prototype, "
|
|
114
|
+
], FiltriUtente.prototype, "codDip", void 0);
|
|
115
|
+
class GetFiltriUtenteResponse extends BaseResponse_1.BaseResponse {
|
|
116
|
+
}
|
|
117
|
+
exports.GetFiltriUtenteResponse = GetFiltriUtenteResponse;
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, swagger_1.ApiProperty)({ type: FiltriUtente }),
|
|
120
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
121
|
+
(0, class_transformer_1.Type)(() => FiltriUtente),
|
|
122
|
+
__metadata("design:type", Array)
|
|
123
|
+
], GetFiltriUtenteResponse.prototype, "Result", void 0);
|
|
124
|
+
class GetFiltriUtenteRequest {
|
|
125
|
+
}
|
|
126
|
+
exports.GetFiltriUtenteRequest = GetFiltriUtenteRequest;
|
|
88
127
|
__decorate([
|
|
89
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
128
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
129
|
+
description: 'Codice utente',
|
|
130
|
+
}),
|
|
131
|
+
(0, class_validator_1.IsNumber)(),
|
|
132
|
+
(0, class_validator_1.IsOptional)(),
|
|
90
133
|
__metadata("design:type", Number)
|
|
91
|
-
],
|
|
134
|
+
], GetFiltriUtenteRequest.prototype, "codUte", void 0);
|
|
135
|
+
exports.FILTRI_UTENTE_DB_MAPPING = {
|
|
136
|
+
progressivo: { dbField: 'PROG', numeric: true },
|
|
137
|
+
numRep: { dbField: 'NUMREP', numeric: true },
|
|
138
|
+
idxPers: { dbField: 'IDXPERS', numeric: true },
|
|
139
|
+
codCliSuper: { dbField: 'CODCLISUPER', numeric: true },
|
|
140
|
+
codAge: { dbField: 'CODAGE', numeric: true },
|
|
141
|
+
codCliCol: { dbField: 'CODCLICOL', numeric: true },
|
|
142
|
+
codClienti: { dbField: 'CODCLIENTI', numeric: false },
|
|
143
|
+
tipFil: { dbField: 'TIPFIL', numeric: true },
|
|
144
|
+
idxPos: { dbField: 'IDXPOS', numeric: true },
|
|
145
|
+
codDip: { dbField: 'CODDIP', numeric: true },
|
|
146
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Permission } from "./Permission";
|
|
2
|
-
|
|
2
|
+
import { FiltriUtente } from "./FiltriUtente";
|
|
3
|
+
declare const RegisterRequest_base: import("@nestjs/common").Type<Omit<FiltriUtente, "codUte">>;
|
|
4
|
+
export declare class RegisterRequest extends RegisterRequest_base {
|
|
3
5
|
email: string;
|
|
4
6
|
cognome?: string;
|
|
5
7
|
nome?: string;
|
|
@@ -7,17 +9,10 @@ export declare class RegisterRequest {
|
|
|
7
9
|
flagSuper?: boolean;
|
|
8
10
|
roles?: string[];
|
|
9
11
|
permissions?: Permission[];
|
|
10
|
-
numeroReport?: number;
|
|
11
|
-
indicePersonale?: number;
|
|
12
|
-
codiceClienteSuper?: number;
|
|
13
|
-
codAge?: number;
|
|
14
|
-
codiceClienteCollegato?: number;
|
|
15
|
-
codiceClienti?: string;
|
|
16
|
-
tipoFiltro?: number;
|
|
17
12
|
avatar?: string;
|
|
18
13
|
flagDueFattori?: boolean;
|
|
19
14
|
paginaDefault?: string;
|
|
20
15
|
ragSocCli?: string;
|
|
21
16
|
htmlMail?: string;
|
|
22
|
-
idxPostazione?: number;
|
|
23
17
|
}
|
|
18
|
+
export {};
|
|
@@ -13,7 +13,8 @@ exports.RegisterRequest = void 0;
|
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const Permission_1 = require("./Permission");
|
|
15
15
|
const TipoAbilitazione_1 = require("./TipoAbilitazione");
|
|
16
|
-
|
|
16
|
+
const FiltriUtente_1 = require("./FiltriUtente");
|
|
17
|
+
class RegisterRequest extends (0, swagger_1.OmitType)(FiltriUtente_1.FiltriUtente, ['codUte']) {
|
|
17
18
|
}
|
|
18
19
|
exports.RegisterRequest = RegisterRequest;
|
|
19
20
|
__decorate([
|
|
@@ -66,55 +67,6 @@ __decorate([
|
|
|
66
67
|
}),
|
|
67
68
|
__metadata("design:type", Array)
|
|
68
69
|
], RegisterRequest.prototype, "permissions", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
71
|
-
description: "Numero del report associato.",
|
|
72
|
-
example: 1002,
|
|
73
|
-
}),
|
|
74
|
-
__metadata("design:type", Number)
|
|
75
|
-
], RegisterRequest.prototype, "numeroReport", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
78
|
-
description: "Indice personale dell'utente.",
|
|
79
|
-
example: 15,
|
|
80
|
-
}),
|
|
81
|
-
__metadata("design:type", Number)
|
|
82
|
-
], RegisterRequest.prototype, "indicePersonale", void 0);
|
|
83
|
-
__decorate([
|
|
84
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
85
|
-
description: "Codice del cliente principale (super).",
|
|
86
|
-
example: 123,
|
|
87
|
-
}),
|
|
88
|
-
__metadata("design:type", Number)
|
|
89
|
-
], RegisterRequest.prototype, "codiceClienteSuper", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
92
|
-
description: "Codice dell'agen te associato.",
|
|
93
|
-
example: 123,
|
|
94
|
-
}),
|
|
95
|
-
__metadata("design:type", Number)
|
|
96
|
-
], RegisterRequest.prototype, "codAge", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
99
|
-
description: "Codice del cliente collegato.",
|
|
100
|
-
example: "123",
|
|
101
|
-
}),
|
|
102
|
-
__metadata("design:type", Number)
|
|
103
|
-
], RegisterRequest.prototype, "codiceClienteCollegato", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
106
|
-
description: "Lista di codici clienti separati da virgola.",
|
|
107
|
-
example: "CLT_123,CLT_456,CLT_789",
|
|
108
|
-
}),
|
|
109
|
-
__metadata("design:type", String)
|
|
110
|
-
], RegisterRequest.prototype, "codiceClienti", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
113
|
-
description: "Tipo di filtro applicato.",
|
|
114
|
-
example: "esclusivo",
|
|
115
|
-
}),
|
|
116
|
-
__metadata("design:type", Number)
|
|
117
|
-
], RegisterRequest.prototype, "tipoFiltro", void 0);
|
|
118
70
|
__decorate([
|
|
119
71
|
(0, swagger_1.ApiPropertyOptional)({
|
|
120
72
|
description: "Avatar dell'utente.",
|
|
@@ -150,10 +102,3 @@ __decorate([
|
|
|
150
102
|
}),
|
|
151
103
|
__metadata("design:type", String)
|
|
152
104
|
], RegisterRequest.prototype, "htmlMail", void 0);
|
|
153
|
-
__decorate([
|
|
154
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
155
|
-
description: 'idx della postazione nella tabella ANTENNE_POS di PROLAV',
|
|
156
|
-
example: '12',
|
|
157
|
-
}),
|
|
158
|
-
__metadata("design:type", Number)
|
|
159
|
-
], RegisterRequest.prototype, "idxPostazione", void 0);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseResponse } from './BaseResponse';
|
|
2
|
+
export declare class TipoFiltro {
|
|
3
|
+
tipFil: number;
|
|
4
|
+
desFil?: string;
|
|
5
|
+
fldFil?: string;
|
|
6
|
+
flgEnabled?: 0 | 1;
|
|
7
|
+
}
|
|
8
|
+
export declare class GetFiltriResponse extends BaseResponse {
|
|
9
|
+
Result: TipoFiltro[];
|
|
10
|
+
}
|
|
11
|
+
export declare class GetFiltriRequest {
|
|
12
|
+
flgEnabled?: 0 | 1;
|
|
13
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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.GetFiltriRequest = exports.GetFiltriResponse = exports.TipoFiltro = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const BaseResponse_1 = require("./BaseResponse");
|
|
17
|
+
class TipoFiltro {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.flgEnabled = 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.TipoFiltro = TipoFiltro;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({
|
|
25
|
+
description: 'Identificativo del tipo di filtro',
|
|
26
|
+
example: 1,
|
|
27
|
+
type: Number,
|
|
28
|
+
}),
|
|
29
|
+
(0, class_validator_1.IsInt)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
__metadata("design:type", Number)
|
|
32
|
+
], TipoFiltro.prototype, "tipFil", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({
|
|
35
|
+
description: 'Descrizione del filtro',
|
|
36
|
+
example: 'Filtro standard',
|
|
37
|
+
maxLength: 20,
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
(0, class_validator_1.IsString)(),
|
|
41
|
+
(0, class_validator_1.MaxLength)(20),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], TipoFiltro.prototype, "desFil", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)({
|
|
47
|
+
description: 'Campo associato al filtro',
|
|
48
|
+
example: 'campoValore',
|
|
49
|
+
maxLength: 20,
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
(0, class_validator_1.IsString)(),
|
|
53
|
+
(0, class_validator_1.MaxLength)(20),
|
|
54
|
+
(0, class_validator_1.IsOptional)(),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], TipoFiltro.prototype, "fldFil", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({
|
|
59
|
+
description: 'Filtro abilitato',
|
|
60
|
+
example: 1,
|
|
61
|
+
enum: [0, 1],
|
|
62
|
+
required: false,
|
|
63
|
+
default: 1,
|
|
64
|
+
}),
|
|
65
|
+
(0, class_validator_1.IsIn)([0, 1]),
|
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
|
67
|
+
__metadata("design:type", Number)
|
|
68
|
+
], TipoFiltro.prototype, "flgEnabled", void 0);
|
|
69
|
+
class GetFiltriResponse extends BaseResponse_1.BaseResponse {
|
|
70
|
+
}
|
|
71
|
+
exports.GetFiltriResponse = GetFiltriResponse;
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, swagger_1.ApiProperty)({ type: TipoFiltro, isArray: true }),
|
|
74
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
75
|
+
(0, class_transformer_1.Type)(() => TipoFiltro),
|
|
76
|
+
__metadata("design:type", Array)
|
|
77
|
+
], GetFiltriResponse.prototype, "Result", void 0);
|
|
78
|
+
class GetFiltriRequest {
|
|
79
|
+
}
|
|
80
|
+
exports.GetFiltriRequest = GetFiltriRequest;
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
83
|
+
description: 'Mostra solo abilitati',
|
|
84
|
+
enum: [0, 1]
|
|
85
|
+
}),
|
|
86
|
+
(0, class_validator_1.IsOptional)(),
|
|
87
|
+
(0, class_validator_1.IsIn)([0, 1]),
|
|
88
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
89
|
+
__metadata("design:type", Number)
|
|
90
|
+
], GetFiltriRequest.prototype, "flgEnabled", void 0);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { StatoRegistrazione } from './StatoRegistrazione';
|
|
2
2
|
import { Permission } from './Permission';
|
|
3
|
-
|
|
3
|
+
import { FiltriUtente } from './FiltriUtente';
|
|
4
|
+
declare const UserDto_base: import("@nestjs/common").Type<Omit<FiltriUtente, "codUte">>;
|
|
5
|
+
export declare class UserDto extends UserDto_base {
|
|
4
6
|
codiceUtente: number;
|
|
5
7
|
email: string;
|
|
6
8
|
flagGdpr?: boolean;
|
|
@@ -22,13 +24,5 @@ export declare class UserDto {
|
|
|
22
24
|
ragSocCli?: string;
|
|
23
25
|
roles?: string[];
|
|
24
26
|
permissions?: Permission[];
|
|
25
|
-
prog?: number;
|
|
26
|
-
numRep?: number;
|
|
27
|
-
idxPers?: number;
|
|
28
|
-
codiceClienteSuper?: number;
|
|
29
|
-
codAge?: number;
|
|
30
|
-
codiceClienteCol?: number;
|
|
31
|
-
codiceClienti?: string;
|
|
32
|
-
tipoFiltro?: number;
|
|
33
|
-
idxPostazione?: number;
|
|
34
27
|
}
|
|
28
|
+
export {};
|
|
@@ -14,7 +14,8 @@ const swagger_1 = require("@nestjs/swagger");
|
|
|
14
14
|
const StatoRegistrazione_1 = require("./StatoRegistrazione");
|
|
15
15
|
const Permission_1 = require("./Permission");
|
|
16
16
|
const TipoAbilitazione_1 = require("./TipoAbilitazione");
|
|
17
|
-
|
|
17
|
+
const FiltriUtente_1 = require("./FiltriUtente");
|
|
18
|
+
class UserDto extends (0, swagger_1.OmitType)(FiltriUtente_1.FiltriUtente, ['codUte']) {
|
|
18
19
|
}
|
|
19
20
|
exports.UserDto = UserDto;
|
|
20
21
|
__decorate([
|
|
@@ -145,42 +146,3 @@ __decorate([
|
|
|
145
146
|
}),
|
|
146
147
|
__metadata("design:type", Array)
|
|
147
148
|
], UserDto.prototype, "permissions", void 0);
|
|
148
|
-
__decorate([
|
|
149
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Progressivo interno.', example: 1001 }),
|
|
150
|
-
__metadata("design:type", Number)
|
|
151
|
-
], UserDto.prototype, "prog", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Numero di report.', example: 5 }),
|
|
154
|
-
__metadata("design:type", Number)
|
|
155
|
-
], UserDto.prototype, "numRep", void 0);
|
|
156
|
-
__decorate([
|
|
157
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Indice personalizzato.', example: 200 }),
|
|
158
|
-
__metadata("design:type", Number)
|
|
159
|
-
], UserDto.prototype, "idxPers", void 0);
|
|
160
|
-
__decorate([
|
|
161
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Codice cliente super.', example: 123 }),
|
|
162
|
-
__metadata("design:type", Number)
|
|
163
|
-
], UserDto.prototype, "codiceClienteSuper", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Codice agente.', example: 123 }),
|
|
166
|
-
__metadata("design:type", Number)
|
|
167
|
-
], UserDto.prototype, "codAge", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Codice cliente collettivo.', example: 123 }),
|
|
170
|
-
__metadata("design:type", Number)
|
|
171
|
-
], UserDto.prototype, "codiceClienteCol", void 0);
|
|
172
|
-
__decorate([
|
|
173
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Codici multipli clienti.', example: 'CLI001, CLI002' }),
|
|
174
|
-
__metadata("design:type", String)
|
|
175
|
-
], UserDto.prototype, "codiceClienti", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
(0, swagger_1.ApiPropertyOptional)({ description: 'Tipo di filtro.', example: 'HQ' }),
|
|
178
|
-
__metadata("design:type", Number)
|
|
179
|
-
], UserDto.prototype, "tipoFiltro", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
182
|
-
description: 'idx della postazione nella tabella ANTENNE_POS di PROLAV',
|
|
183
|
-
example: '12',
|
|
184
|
-
}),
|
|
185
|
-
__metadata("design:type", Number)
|
|
186
|
-
], UserDto.prototype, "idxPostazione", void 0);
|
|
@@ -3,11 +3,13 @@ import { UserService } from "../UserService/UserService";
|
|
|
3
3
|
import { PermissionService } from "../PermissionService/PermissionService";
|
|
4
4
|
import { LoginRequest } from "../../Dtos/LoginRequest";
|
|
5
5
|
import { LoginResult } from "../../Dtos/LoginResponse";
|
|
6
|
+
import { FiltriService } from "../FiltriService/FiltriService";
|
|
6
7
|
export declare class AuthService {
|
|
7
8
|
private userService;
|
|
8
9
|
private permissionService;
|
|
10
|
+
private filtriService;
|
|
9
11
|
private readonly accessiOptions;
|
|
10
|
-
constructor(userService: UserService, permissionService: PermissionService, accessiOptions: AccessiOptions);
|
|
12
|
+
constructor(userService: UserService, permissionService: PermissionService, filtriService: FiltriService, accessiOptions: AccessiOptions);
|
|
11
13
|
login(request: LoginRequest): Promise<LoginResult>;
|
|
12
14
|
setPassword(codiceUtente: number, nuovaPassword: string): Promise<any>;
|
|
13
15
|
verifyPassword(codiceUtente: number, passwordCifrata: string): Promise<boolean>;
|
|
@@ -28,10 +28,12 @@ const StatoRegistrazione_1 = require("../../Dtos/StatoRegistrazione");
|
|
|
28
28
|
const common_1 = require("@nestjs/common");
|
|
29
29
|
const UserService_1 = require("../UserService/UserService");
|
|
30
30
|
const PermissionService_1 = require("../PermissionService/PermissionService");
|
|
31
|
+
const FiltriService_1 = require("../FiltriService/FiltriService");
|
|
31
32
|
let AuthService = class AuthService {
|
|
32
|
-
constructor(userService, permissionService, accessiOptions) {
|
|
33
|
+
constructor(userService, permissionService, filtriService, accessiOptions) {
|
|
33
34
|
this.userService = userService;
|
|
34
35
|
this.permissionService = permissionService;
|
|
36
|
+
this.filtriService = filtriService;
|
|
35
37
|
this.accessiOptions = accessiOptions;
|
|
36
38
|
}
|
|
37
39
|
login(request) {
|
|
@@ -74,7 +76,7 @@ let AuthService = class AuthService {
|
|
|
74
76
|
// Recupera i grants
|
|
75
77
|
const userGrants = yield this.permissionService.getUserRolesAndGrants(utente.codiceUtente);
|
|
76
78
|
// Recupera i filtri
|
|
77
|
-
const filtri = yield this.
|
|
79
|
+
const filtri = yield this.filtriService.getFiltriUser(utente.codiceUtente);
|
|
78
80
|
const updateLastAccessDateQuery = "UPDATE UTENTI SET DATLASTLOGIN = CURRENT_TIMESTAMP WHERE CODUTE = ?";
|
|
79
81
|
yield Orm_1.Orm.query(this.accessiOptions.databaseOptions, updateLastAccessDateQuery, [utente.codiceUtente]);
|
|
80
82
|
let extensionFields = {};
|
|
@@ -188,7 +190,8 @@ let AuthService = class AuthService {
|
|
|
188
190
|
exports.AuthService = AuthService;
|
|
189
191
|
exports.AuthService = AuthService = __decorate([
|
|
190
192
|
(0, common_1.Injectable)(),
|
|
191
|
-
__param(
|
|
193
|
+
__param(3, (0, common_1.Inject)("ACCESSI_OPTIONS")),
|
|
192
194
|
__metadata("design:paramtypes", [UserService_1.UserService,
|
|
193
|
-
PermissionService_1.PermissionService,
|
|
195
|
+
PermissionService_1.PermissionService,
|
|
196
|
+
FiltriService_1.FiltriService, Object])
|
|
194
197
|
], AuthService);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AccessiOptions } from '../../AccessiModule';
|
|
2
|
+
import { TipoFiltro } from '../../Dtos/TipoFiltro';
|
|
3
|
+
import { FiltriUtente } from '../../Dtos';
|
|
4
|
+
export declare class FiltriService {
|
|
5
|
+
private readonly accessiOptions;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(accessiOptions: AccessiOptions);
|
|
8
|
+
getTipoFiltri(): Promise<TipoFiltro[]>;
|
|
9
|
+
getFiltriUser(codUte: number): Promise<FiltriUtente[]>;
|
|
10
|
+
upsertFiltriUtente(codUte: number, dto: Partial<FiltriUtente>): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var FiltriService_1;
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.FiltriService = void 0;
|
|
26
|
+
const common_1 = require("@nestjs/common");
|
|
27
|
+
const Orm_1 = require("../../../Orm");
|
|
28
|
+
const Utilities_1 = require("../../../Utilities");
|
|
29
|
+
const Logger_1 = require("../../../Logger");
|
|
30
|
+
const Dtos_1 = require("../../Dtos");
|
|
31
|
+
let FiltriService = FiltriService_1 = class FiltriService {
|
|
32
|
+
constructor(accessiOptions) {
|
|
33
|
+
this.accessiOptions = accessiOptions;
|
|
34
|
+
this.logger = new Logger_1.Logger(FiltriService_1.name);
|
|
35
|
+
}
|
|
36
|
+
getTipoFiltri() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
try {
|
|
39
|
+
let getQuery = 'SELECT TIPFIL AS TIP_FIL, DESFIL AS DES_FIL, FLDFIL AS FLD_FIL, FLGENABLED AS FLG_ENABLED FROM FILTRI_TIPO';
|
|
40
|
+
const params = [];
|
|
41
|
+
let result = yield Orm_1.Orm.query(this.accessiOptions.databaseOptions, getQuery, params);
|
|
42
|
+
return result.map(Utilities_1.RestUtilities.convertKeysToCamelCase);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.logger.error('Errore durante il recupero dei tipi di filtri', error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getFiltriUser(codUte) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
try {
|
|
53
|
+
let params = [];
|
|
54
|
+
let getQuery = `SELECT CODUTE AS COD_UTE, PROG AS PROGRESSIVO, NUMREP AS NUM_REP, IDXPERS AS IDX_PERS, CODCLISUPER AS COD_CLI_SUPER, CODAGE AS COD_AGE, CODCLICOL AS COD_CLI_COL,
|
|
55
|
+
CODCLIENTI AS COD_CLIENTI, TIPFIL AS TIP_FIL, CODDIP AS COD_DIP, IDXPOS AS IDX_POS FROM FILTRI `;
|
|
56
|
+
if (codUte === undefined) {
|
|
57
|
+
this.logger.log('Nessun utente passato, recupero i filtri di tutti gli utenti...');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.logger.log('codUte passato, recupero i filtri dell utente ' + codUte);
|
|
61
|
+
getQuery += ' WHERE CODUTE = ?';
|
|
62
|
+
params.push(codUte);
|
|
63
|
+
}
|
|
64
|
+
let result = yield Orm_1.Orm.query(this.accessiOptions.databaseOptions, getQuery, params);
|
|
65
|
+
return result.map(Utilities_1.RestUtilities.convertKeysToCamelCase);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
upsertFiltriUtente(codUte, dto) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
try {
|
|
75
|
+
console.debug('Dati utente da aggiornare: ', dto);
|
|
76
|
+
if (!codUte || codUte <= 0)
|
|
77
|
+
throw new Error('Codice utente non valido');
|
|
78
|
+
const dbFields = ['CODUTE'];
|
|
79
|
+
const values = [codUte];
|
|
80
|
+
//aggiungo solo campi valorizzati
|
|
81
|
+
for (const [key, cfg] of Object.entries(Dtos_1.FILTRI_UTENTE_DB_MAPPING)) {
|
|
82
|
+
console.log('valuto campo: ', key);
|
|
83
|
+
const value = dto[key];
|
|
84
|
+
//gestione campi vuoti, null o undefined
|
|
85
|
+
if (value === undefined) {
|
|
86
|
+
console.log(`Campo ${key} vuoto: ${value}`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (value === null || value === '') {
|
|
90
|
+
dbFields.push(cfg.dbField);
|
|
91
|
+
values.push(null);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// if (value === undefined || value === null || value === '') {
|
|
95
|
+
// console.log(`Campo ${key} vuoto: ${value}`)
|
|
96
|
+
// continue;
|
|
97
|
+
// }
|
|
98
|
+
if (cfg.numeric && typeof value !== 'number') {
|
|
99
|
+
throw new Error(`Il campo ${key} deve essere un numero`);
|
|
100
|
+
}
|
|
101
|
+
if (!cfg.numeric && typeof value !== 'string') {
|
|
102
|
+
throw new Error(`Il campo ${key} deve essere una stringa`);
|
|
103
|
+
}
|
|
104
|
+
dbFields.push(cfg.dbField);
|
|
105
|
+
values.push(value);
|
|
106
|
+
}
|
|
107
|
+
if (dbFields.length === 1) {
|
|
108
|
+
this.logger.log(`Nessun campo valido da inserire per l'utente ${codUte}`);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
let sSql = `UPDATE OR INSERT INTO FILTRI (${dbFields.join(',')}) VALUES (${values.map(() => '?').join(', ')}) MATCHING (CODUTE)`;
|
|
112
|
+
yield Orm_1.Orm.execute(this.accessiOptions.databaseOptions, sSql, values);
|
|
113
|
+
this.logger.log('Update or Insert filtri OK per CODUTE = ' + codUte);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
throw new Error(`Errore durante update or insert filtri per utente ${codUte}: ${error.message}`);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.FiltriService = FiltriService;
|
|
122
|
+
exports.FiltriService = FiltriService = FiltriService_1 = __decorate([
|
|
123
|
+
(0, common_1.Injectable)(),
|
|
124
|
+
__param(0, (0, common_1.Inject)('ACCESSI_OPTIONS')),
|
|
125
|
+
__metadata("design:paramtypes", [Object])
|
|
126
|
+
], FiltriService);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { AccessiOptions } from '../../AccessiModule';
|
|
2
2
|
import { StatoRegistrazione } from '../../Dtos/StatoRegistrazione';
|
|
3
3
|
import { EmailService } from '../EmailService/EmailService';
|
|
4
|
-
import { FiltriUtente } from '../../Dtos/FiltriUtente';
|
|
5
4
|
import { GetUsersResult } from '../../Dtos/GetUsersResponse';
|
|
6
5
|
import { PermissionService } from '../PermissionService/PermissionService';
|
|
7
6
|
import { UserDto } from '../../Dtos';
|
|
8
7
|
import { RegisterRequest } from '../../Dtos/RegisterRequest';
|
|
8
|
+
import { FiltriService } from '../FiltriService/FiltriService';
|
|
9
9
|
export declare class UserService {
|
|
10
10
|
private readonly accessiOptions;
|
|
11
11
|
private readonly emailService;
|
|
12
12
|
private readonly permissionService;
|
|
13
|
-
|
|
13
|
+
private readonly filtriService;
|
|
14
|
+
constructor(accessiOptions: AccessiOptions, emailService: EmailService, permissionService: PermissionService, filtriService: FiltriService);
|
|
14
15
|
getUsers(filters?: {
|
|
15
16
|
email?: string;
|
|
16
17
|
codiceUtente?: number;
|
|
@@ -22,7 +23,6 @@ export declare class UserService {
|
|
|
22
23
|
codiceUtente: number;
|
|
23
24
|
}>;
|
|
24
25
|
getUserByEmail(email: string): Promise<UserDto | null>;
|
|
25
|
-
getUserFilters(codiceUtente: number): Promise<FiltriUtente[]>;
|
|
26
26
|
insertUserFilters(codiceUtente: number, filterData: RegisterRequest): Promise<void>;
|
|
27
27
|
private executeInTransaction;
|
|
28
28
|
register(registrationData: RegisterRequest): Promise<string>;
|
|
@@ -29,11 +29,13 @@ const Utilities_1 = require("../../../Utilities");
|
|
|
29
29
|
const StatoRegistrazione_1 = require("../../Dtos/StatoRegistrazione");
|
|
30
30
|
const EmailService_1 = require("../EmailService/EmailService");
|
|
31
31
|
const PermissionService_1 = require("../PermissionService/PermissionService");
|
|
32
|
+
const FiltriService_1 = require("../FiltriService/FiltriService");
|
|
32
33
|
let UserService = class UserService {
|
|
33
|
-
constructor(accessiOptions, emailService, permissionService) {
|
|
34
|
+
constructor(accessiOptions, emailService, permissionService, filtriService) {
|
|
34
35
|
this.accessiOptions = accessiOptions;
|
|
35
36
|
this.emailService = emailService;
|
|
36
37
|
this.permissionService = permissionService;
|
|
38
|
+
this.filtriService = filtriService;
|
|
37
39
|
}
|
|
38
40
|
getUsers(filters, options) {
|
|
39
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -63,8 +65,8 @@ let UserService = class UserService {
|
|
|
63
65
|
F.CODCLISUPER AS cod_cli_super,
|
|
64
66
|
F.CODAGE AS cod_age,
|
|
65
67
|
F.CODCLICOL AS cod_cli_col,
|
|
66
|
-
F.CODCLIENTI AS
|
|
67
|
-
F.TIPFIL AS
|
|
68
|
+
F.CODCLIENTI AS cod_clienti,
|
|
69
|
+
F.TIPFIL AS tip_fil,
|
|
68
70
|
F.IDXPOS AS idx_postazione
|
|
69
71
|
FROM UTENTI U
|
|
70
72
|
INNER JOIN UTENTI_CONFIG G ON U.CODUTE = G.CODUTE
|
|
@@ -152,25 +154,25 @@ let UserService = class UserService {
|
|
|
152
154
|
return utenti.length > 0 ? utenti[0] : null;
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
|
-
getUserFilters(codiceUtente) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
157
|
+
// async getUserFilters(codiceUtente: number): Promise<FiltriUtente[]> {
|
|
158
|
+
// const query = `
|
|
159
|
+
// SELECT
|
|
160
|
+
// F.PROG AS progressivo,
|
|
161
|
+
// F.NUMREP AS numero_report,
|
|
162
|
+
// F.IDXPERS AS indice_personale,
|
|
163
|
+
// F.CODCLISUPER AS codice_cliente_super,
|
|
164
|
+
// F.CODAGE AS cod_age,
|
|
165
|
+
// F.CODCLICOL AS codice_cliente_collegato,
|
|
166
|
+
// F.CODCLIENTI AS codice_clienti,
|
|
167
|
+
// F.TIPFIL AS tipo_filtro,
|
|
168
|
+
// F.IDXPOS AS idx_postazione
|
|
169
|
+
// FROM FILTRI F
|
|
170
|
+
// WHERE F.CODUTE = ?
|
|
171
|
+
// `;
|
|
172
|
+
// return (await Orm.query(this.accessiOptions.databaseOptions, query, [codiceUtente]).then(
|
|
173
|
+
// (results) => results.map(RestUtilities.convertKeysToCamelCase),
|
|
174
|
+
// )) as FiltriUtente[];
|
|
175
|
+
// }
|
|
174
176
|
insertUserFilters(codiceUtente, filterData) {
|
|
175
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
176
178
|
try {
|
|
@@ -184,7 +186,7 @@ let UserService = class UserService {
|
|
|
184
186
|
codAge: { dbField: 'CODAGE', type: 'number' },
|
|
185
187
|
codiceClienteCollegato: { dbField: 'CODCLICOL', type: 'number' },
|
|
186
188
|
codiceClienti: { dbField: 'CODCLIENTI', type: 'string' },
|
|
187
|
-
|
|
189
|
+
tipFil: { dbField: 'TIPFIL', type: 'number' },
|
|
188
190
|
idxPostazione: { dbField: 'IDXPOS', type: 'number' },
|
|
189
191
|
};
|
|
190
192
|
const fieldsToInsert = Object.entries(fieldMapping)
|
|
@@ -256,7 +258,8 @@ let UserService = class UserService {
|
|
|
256
258
|
}
|
|
257
259
|
const queryUtentiConfig = `INSERT INTO UTENTI_CONFIG (${utentiConfigFields.join(', ')}) VALUES (${utentiConfigPlaceholders.join(', ')})`;
|
|
258
260
|
yield Orm_1.Orm.execute(this.accessiOptions.databaseOptions, queryUtentiConfig, utentiConfigParams);
|
|
259
|
-
|
|
261
|
+
//await this.insertUserFilters(codiceUtente, registrationData);
|
|
262
|
+
yield this.filtriService.upsertFiltriUtente(codiceUtente, registrationData);
|
|
260
263
|
if (!!registrationData.roles && registrationData.roles.length > 0) {
|
|
261
264
|
yield this.permissionService.assignRolesToUser(codiceUtente, registrationData.roles);
|
|
262
265
|
}
|
|
@@ -349,7 +352,8 @@ let UserService = class UserService {
|
|
|
349
352
|
if (!!user.permissions && user.permissions.length > 0) {
|
|
350
353
|
yield this.permissionService.assignPermissionsToUser(codiceUtente, user.permissions);
|
|
351
354
|
}
|
|
352
|
-
|
|
355
|
+
//await this.updateUserFilters(codiceUtente, user);
|
|
356
|
+
yield this.filtriService.upsertFiltriUtente(codiceUtente, user);
|
|
353
357
|
}
|
|
354
358
|
catch (error) {
|
|
355
359
|
throw error;
|
|
@@ -369,7 +373,7 @@ let UserService = class UserService {
|
|
|
369
373
|
codAge: { dbField: 'CODAGE', type: 'number' },
|
|
370
374
|
codCliCol: { dbField: 'CODCLICOL', type: 'number' },
|
|
371
375
|
codiceClienti: { dbField: 'CODCLIENTI', type: 'string' },
|
|
372
|
-
|
|
376
|
+
tipFil: { dbField: 'TIPFIL', type: 'number' },
|
|
373
377
|
idxPostazione: { dbField: 'IDXPOS', type: 'number' },
|
|
374
378
|
};
|
|
375
379
|
const fieldsToUpdate = Object.entries(fieldMapping)
|
|
@@ -468,5 +472,6 @@ exports.UserService = UserService = __decorate([
|
|
|
468
472
|
(0, common_1.Injectable)(),
|
|
469
473
|
__param(0, (0, common_1.Inject)('ACCESSI_OPTIONS')),
|
|
470
474
|
__metadata("design:paramtypes", [Object, EmailService_1.EmailService,
|
|
471
|
-
PermissionService_1.PermissionService
|
|
475
|
+
PermissionService_1.PermissionService,
|
|
476
|
+
FiltriService_1.FiltriService])
|
|
472
477
|
], UserService);
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|