emilsoftware-utilities 1.3.127 → 1.3.129
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/Dtos/GetUsersResponse.js +2 -2
- package/dist/accessi-module/index.js +2 -1
- package/dist/accessi-module/swagger/SwaggerConfig.d.ts +1 -1
- package/dist/accessi-module/swagger/SwaggerConfig.js +2 -2
- package/dist/allegati-module/AllegatiModule.d.ts +8 -0
- package/dist/allegati-module/AllegatiModule.js +37 -0
- package/dist/allegati-module/Controllers/AllegatiController.d.ts +35 -0
- package/dist/allegati-module/Controllers/AllegatiController.js +221 -0
- package/dist/allegati-module/Dtos/AllegatoDto.d.ts +14 -0
- package/dist/allegati-module/Dtos/AllegatoDto.js +124 -0
- package/dist/allegati-module/Dtos/BaseResponse.d.ts +7 -0
- package/dist/allegati-module/Dtos/BaseResponse.js +38 -0
- package/dist/allegati-module/Dtos/UploadSingleFileRequest.d.ts +11 -0
- package/dist/allegati-module/Dtos/UploadSingleFileRequest.js +79 -0
- package/dist/allegati-module/Dtos/index.d.ts +3 -0
- package/dist/allegati-module/Dtos/index.js +19 -0
- package/dist/allegati-module/Dtos/responses/DownloadAllegatoResponseDto.d.ts +5 -0
- package/dist/allegati-module/Dtos/responses/DownloadAllegatoResponseDto.js +44 -0
- package/dist/allegati-module/Dtos/responses/GetListResponse.d.ts +5 -0
- package/dist/allegati-module/Dtos/responses/GetListResponse.js +26 -0
- package/dist/allegati-module/Dtos/responses/UploadAllegatoResponseDto.d.ts +4 -0
- package/dist/allegati-module/Dtos/responses/UploadAllegatoResponseDto.js +34 -0
- package/dist/allegati-module/Services/AllegatiService/AllegatiService.d.ts +54 -0
- package/dist/allegati-module/Services/AllegatiService/AllegatiService.js +431 -0
- package/dist/allegati-module/index.d.ts +5 -0
- package/dist/allegati-module/index.js +57 -0
- package/dist/allegati-module/swagger/SwaggerConfig.d.ts +2 -0
- package/dist/allegati-module/swagger/SwaggerConfig.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +7 -3
- package/dist/tests/contract/test.d.ts +0 -1
- package/dist/tests/contract/test.js +0 -69
|
@@ -39,8 +39,8 @@ class GetUsersResponse extends BaseResponse_1.BaseResponse {
|
|
|
39
39
|
}
|
|
40
40
|
exports.GetUsersResponse = GetUsersResponse;
|
|
41
41
|
__decorate([
|
|
42
|
-
(0, swagger_1.ApiProperty)({ type: [
|
|
42
|
+
(0, swagger_1.ApiProperty)({ type: [GetUsersResult] }),
|
|
43
43
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
44
|
-
(0, class_transformer_1.Type)(() =>
|
|
44
|
+
(0, class_transformer_1.Type)(() => GetUsersResult),
|
|
45
45
|
__metadata("design:type", Array)
|
|
46
46
|
], GetUsersResponse.prototype, "Result", void 0);
|
|
@@ -33,6 +33,7 @@ const Logger_1 = require("../Logger");
|
|
|
33
33
|
function initializeAccessiModule(app, options) {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
const logger = new Logger_1.Logger("initializeAccessiModule");
|
|
36
|
+
console.log("Accessi initialized");
|
|
36
37
|
try {
|
|
37
38
|
// Creiamo un'istanza Express separata per NestJS
|
|
38
39
|
const nestExpressInstance = new platform_express_1.ExpressAdapter(app);
|
|
@@ -44,7 +45,7 @@ function initializeAccessiModule(app, options) {
|
|
|
44
45
|
nestApp.setGlobalPrefix('api', {
|
|
45
46
|
exclude: ['/swagger', '/swagger/(.*)']
|
|
46
47
|
});
|
|
47
|
-
(0, SwaggerConfig_1.
|
|
48
|
+
(0, SwaggerConfig_1.setupAccessiSwagger)(nestApp);
|
|
48
49
|
yield nestApp.init();
|
|
49
50
|
}
|
|
50
51
|
catch (error) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { INestApplication } from "@nestjs/common";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function setupAccessiSwagger(app: INestApplication): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setupAccessiSwagger = setupAccessiSwagger;
|
|
4
4
|
const swagger_1 = require("@nestjs/swagger");
|
|
5
5
|
const Logger_1 = require("../../Logger");
|
|
6
|
-
function
|
|
6
|
+
function setupAccessiSwagger(app) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const logger = new Logger_1.Logger("SwaggerConfig");
|
|
9
9
|
const swaggerPath = "swagger/accessi";
|
|
@@ -0,0 +1,37 @@
|
|
|
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 AllegatiModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AllegatiModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const AllegatiService_1 = require("./Services/AllegatiService/AllegatiService");
|
|
13
|
+
const AllegatiController_1 = require("./Controllers/AllegatiController");
|
|
14
|
+
let AllegatiModule = AllegatiModule_1 = class AllegatiModule {
|
|
15
|
+
static forRoot(options) {
|
|
16
|
+
return {
|
|
17
|
+
module: AllegatiModule_1,
|
|
18
|
+
providers: [
|
|
19
|
+
{
|
|
20
|
+
provide: 'ALLEGATI_OPTIONS',
|
|
21
|
+
useValue: options,
|
|
22
|
+
},
|
|
23
|
+
AllegatiService_1.AllegatiService,
|
|
24
|
+
],
|
|
25
|
+
exports: ['ALLEGATI_OPTIONS', AllegatiService_1.AllegatiService],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.AllegatiModule = AllegatiModule;
|
|
30
|
+
exports.AllegatiModule = AllegatiModule = AllegatiModule_1 = __decorate([
|
|
31
|
+
(0, common_1.Global)(),
|
|
32
|
+
(0, common_1.Module)({
|
|
33
|
+
controllers: [AllegatiController_1.AllegatiController],
|
|
34
|
+
providers: [AllegatiService_1.AllegatiService],
|
|
35
|
+
exports: [AllegatiService_1.AllegatiService],
|
|
36
|
+
})
|
|
37
|
+
], AllegatiModule);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AllegatiService } from "../Services/AllegatiService/AllegatiService";
|
|
2
|
+
import { UploadAllegatoResponseDto } from "../Dtos/responses/UploadAllegatoResponseDto";
|
|
3
|
+
import { AllegatoDto } from "../Dtos/AllegatoDto";
|
|
4
|
+
import { DownloadAllegatoResponseDto } from "../Dtos/responses/DownloadAllegatoResponseDto";
|
|
5
|
+
import { UploadSingleFileRequest } from "../Dtos/UploadSingleFileRequest";
|
|
6
|
+
import e from "express";
|
|
7
|
+
export declare class AllegatiController {
|
|
8
|
+
private readonly allegatiService;
|
|
9
|
+
constructor(allegatiService: AllegatiService);
|
|
10
|
+
upload(files: Express.Multer.File[], uploadRequest: UploadSingleFileRequest): Promise<UploadAllegatoResponseDto>;
|
|
11
|
+
download(id: number): Promise<DownloadAllegatoResponseDto>;
|
|
12
|
+
downloadFile(id: number, res: e.Response): Promise<void>;
|
|
13
|
+
delete(id: number, res: e.Response): Promise<e.Response<any, Record<string, any>>>;
|
|
14
|
+
list(tipcod?: string, codice?: number, docrif?: string, idxtipoall?: number): Promise<AllegatoDto[]>;
|
|
15
|
+
searchByFields(body: {
|
|
16
|
+
tipcod?: string;
|
|
17
|
+
codice?: number;
|
|
18
|
+
docrif?: string;
|
|
19
|
+
idxtipoall?: number;
|
|
20
|
+
}): Promise<AllegatoDto[]>;
|
|
21
|
+
getOneByFields(body: {
|
|
22
|
+
tipcod?: string;
|
|
23
|
+
codice?: number;
|
|
24
|
+
docrif?: string;
|
|
25
|
+
idxtipoall?: number;
|
|
26
|
+
}): Promise<AllegatoDto>;
|
|
27
|
+
updateFieldsById(id: number, body: {
|
|
28
|
+
tipcod?: string;
|
|
29
|
+
codice?: number;
|
|
30
|
+
docrif?: string;
|
|
31
|
+
idxtipoall?: number;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
message: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.AllegatiController = void 0;
|
|
28
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
29
|
+
const common_1 = require("@nestjs/common");
|
|
30
|
+
const platform_express_1 = require("@nestjs/platform-express");
|
|
31
|
+
const AllegatiService_1 = require("../Services/AllegatiService/AllegatiService");
|
|
32
|
+
const UploadAllegatoResponseDto_1 = require("../Dtos/responses/UploadAllegatoResponseDto");
|
|
33
|
+
const AllegatoDto_1 = require("../Dtos/AllegatoDto");
|
|
34
|
+
const DownloadAllegatoResponseDto_1 = require("../Dtos/responses/DownloadAllegatoResponseDto");
|
|
35
|
+
const UploadSingleFileRequest_1 = require("../Dtos/UploadSingleFileRequest");
|
|
36
|
+
const Utilities_1 = require("../../Utilities");
|
|
37
|
+
const express_1 = __importDefault(require("express"));
|
|
38
|
+
let AllegatiController = class AllegatiController {
|
|
39
|
+
constructor(allegatiService) {
|
|
40
|
+
this.allegatiService = allegatiService;
|
|
41
|
+
}
|
|
42
|
+
upload(files, uploadRequest) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
if (!files || files.length === 0) {
|
|
45
|
+
throw new common_1.BadRequestException('Nessun file fornito');
|
|
46
|
+
}
|
|
47
|
+
if (files.length > 1) {
|
|
48
|
+
throw new common_1.BadRequestException('Questo endpoint accetta un solo file alla volta');
|
|
49
|
+
}
|
|
50
|
+
return yield this.allegatiService.uploadFile(files[0], uploadRequest);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
download(id) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
return yield this.allegatiService.downloadFile(id);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
downloadFile(id, res) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
try {
|
|
61
|
+
const file = yield this.allegatiService.downloadFile(id);
|
|
62
|
+
// Convert base64 to buffer in chunks
|
|
63
|
+
const chunkSize = 1024 * 1024; // 1MB chunks
|
|
64
|
+
const base64Content = file.contentBase64;
|
|
65
|
+
const bufferSize = Math.ceil((base64Content.length * 3) / 4);
|
|
66
|
+
const buffer = Buffer.alloc(bufferSize);
|
|
67
|
+
let bufferIndex = 0;
|
|
68
|
+
for (let i = 0; i < base64Content.length; i += chunkSize) {
|
|
69
|
+
const chunk = base64Content.slice(i, i + chunkSize);
|
|
70
|
+
const chunkBuffer = Buffer.from(chunk, 'base64');
|
|
71
|
+
chunkBuffer.copy(buffer, bufferIndex);
|
|
72
|
+
bufferIndex += chunkBuffer.length;
|
|
73
|
+
}
|
|
74
|
+
// Set headers for file download
|
|
75
|
+
res.setHeader('Content-Type', file.mimetype);
|
|
76
|
+
res.setHeader('Content-Disposition', `attachment; filename="${file.filename}"`);
|
|
77
|
+
res.setHeader('Content-Length', buffer.length);
|
|
78
|
+
res.status(200).end(buffer);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error('[AllegatiController] downloadFile - Errore:', error);
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
delete(id, res) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
yield this.allegatiService.deleteFile(id);
|
|
89
|
+
return Utilities_1.RestUtilities.sendOKMessage(res, "File eliminato con successo");
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
list(tipcod, codice, docrif, idxtipoall) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
return yield this.allegatiService.listFiles({
|
|
95
|
+
tipcod,
|
|
96
|
+
codice,
|
|
97
|
+
docrif,
|
|
98
|
+
idxtipoall: idxtipoall ? Number(idxtipoall) : undefined
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
searchByFields(body) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
return yield this.allegatiService.findByFields(body);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
getOneByFields(body) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
return yield this.allegatiService.getOneByFields(body);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
updateFieldsById(id, body) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
yield this.allegatiService.updateFieldsById(Number(id), body);
|
|
115
|
+
return { message: 'Aggiornamento completato' };
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
exports.AllegatiController = AllegatiController;
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, common_1.Post)('upload'),
|
|
122
|
+
(0, common_1.UseInterceptors)((0, platform_express_1.FilesInterceptor)('file')),
|
|
123
|
+
(0, swagger_1.ApiConsumes)('multipart/form-data'),
|
|
124
|
+
(0, swagger_1.ApiResponse)({ status: 201, description: 'File caricato con successo.', type: UploadAllegatoResponseDto_1.UploadAllegatoResponseDto }),
|
|
125
|
+
(0, swagger_1.ApiBody)({
|
|
126
|
+
description: 'File e metadati per l\'upload di un allegato',
|
|
127
|
+
required: true,
|
|
128
|
+
schema: {
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {
|
|
131
|
+
file: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
format: 'binary',
|
|
134
|
+
},
|
|
135
|
+
codice: { type: 'integer', example: 1 },
|
|
136
|
+
tipoCodice: { type: 'string', example: 'CF' },
|
|
137
|
+
ordine: { type: 'string', example: '1' },
|
|
138
|
+
descrizioneAllegato: { type: 'string', example: 'Documento di identità' },
|
|
139
|
+
dataInizioValidita: { type: 'string', format: 'date', example: '2024-01-01' },
|
|
140
|
+
dataFineValidita: { type: 'string', format: 'date', example: '2025-01-01' },
|
|
141
|
+
idTipoAllegato: { type: 'integer', example: 3 },
|
|
142
|
+
riferimentoDocumento: { type: 'string', example: 'PRAT-2024-0001' }
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
}),
|
|
146
|
+
__param(0, (0, common_1.UploadedFiles)()),
|
|
147
|
+
__param(1, (0, common_1.Body)()),
|
|
148
|
+
__metadata("design:type", Function),
|
|
149
|
+
__metadata("design:paramtypes", [Array, UploadSingleFileRequest_1.UploadSingleFileRequest]),
|
|
150
|
+
__metadata("design:returntype", Promise)
|
|
151
|
+
], AllegatiController.prototype, "upload", null);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, common_1.Get)(':id'),
|
|
154
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'File scaricato con successo.', type: DownloadAllegatoResponseDto_1.DownloadAllegatoResponseDto }),
|
|
155
|
+
__param(0, (0, common_1.Param)('id')),
|
|
156
|
+
__metadata("design:type", Function),
|
|
157
|
+
__metadata("design:paramtypes", [Number]),
|
|
158
|
+
__metadata("design:returntype", Promise)
|
|
159
|
+
], AllegatiController.prototype, "download", null);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, common_1.Get)(':id/download'),
|
|
162
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'File scaricato con successo.' }),
|
|
163
|
+
__param(0, (0, common_1.Param)('id')),
|
|
164
|
+
__param(1, (0, common_1.Res)()),
|
|
165
|
+
__metadata("design:type", Function),
|
|
166
|
+
__metadata("design:paramtypes", [Number, Object]),
|
|
167
|
+
__metadata("design:returntype", Promise)
|
|
168
|
+
], AllegatiController.prototype, "downloadFile", null);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, common_1.Delete)(':id'),
|
|
171
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'File eliminato con successo.' }),
|
|
172
|
+
__param(0, (0, common_1.Param)('id')),
|
|
173
|
+
__param(1, (0, common_1.Response)()),
|
|
174
|
+
__metadata("design:type", Function),
|
|
175
|
+
__metadata("design:paramtypes", [Number, Object]),
|
|
176
|
+
__metadata("design:returntype", Promise)
|
|
177
|
+
], AllegatiController.prototype, "delete", null);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, common_1.Get)(),
|
|
180
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Lista degli allegati.', type: [AllegatoDto_1.AllegatoDto] }),
|
|
181
|
+
(0, swagger_1.ApiQuery)({ name: 'tipcod', required: false, description: 'Filtra per tipo codice' }),
|
|
182
|
+
(0, swagger_1.ApiQuery)({ name: 'codice', required: false, description: 'Filtra per codice' }),
|
|
183
|
+
(0, swagger_1.ApiQuery)({ name: 'docrif', required: false, description: 'Filtra per riferimento documento' }),
|
|
184
|
+
(0, swagger_1.ApiQuery)({ name: 'idxtipoall', required: false, description: 'Filtra per tipo allegato', type: Number }),
|
|
185
|
+
__param(0, (0, common_1.Query)('tipcod')),
|
|
186
|
+
__param(1, (0, common_1.Query)('codice')),
|
|
187
|
+
__param(2, (0, common_1.Query)('docrif')),
|
|
188
|
+
__param(3, (0, common_1.Query)('idxtipoall')),
|
|
189
|
+
__metadata("design:type", Function),
|
|
190
|
+
__metadata("design:paramtypes", [String, Number, String, Number]),
|
|
191
|
+
__metadata("design:returntype", Promise)
|
|
192
|
+
], AllegatiController.prototype, "list", null);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, common_1.Post)('search'),
|
|
195
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Ricerca allegati per campi.' }),
|
|
196
|
+
__param(0, (0, common_1.Body)()),
|
|
197
|
+
__metadata("design:type", Function),
|
|
198
|
+
__metadata("design:paramtypes", [Object]),
|
|
199
|
+
__metadata("design:returntype", Promise)
|
|
200
|
+
], AllegatiController.prototype, "searchByFields", null);
|
|
201
|
+
__decorate([
|
|
202
|
+
(0, common_1.Post)('get-by-fields'),
|
|
203
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Ottieni un allegato per campi.' }),
|
|
204
|
+
__param(0, (0, common_1.Body)()),
|
|
205
|
+
__metadata("design:type", Function),
|
|
206
|
+
__metadata("design:paramtypes", [Object]),
|
|
207
|
+
__metadata("design:returntype", Promise)
|
|
208
|
+
], AllegatiController.prototype, "getOneByFields", null);
|
|
209
|
+
__decorate([
|
|
210
|
+
(0, common_1.Patch)('update-fields/:id'),
|
|
211
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Aggiorna i campi di un allegato.' }),
|
|
212
|
+
__param(0, (0, common_1.Param)('id')),
|
|
213
|
+
__param(1, (0, common_1.Body)()),
|
|
214
|
+
__metadata("design:type", Function),
|
|
215
|
+
__metadata("design:paramtypes", [Number, Object]),
|
|
216
|
+
__metadata("design:returntype", Promise)
|
|
217
|
+
], AllegatiController.prototype, "updateFieldsById", null);
|
|
218
|
+
exports.AllegatiController = AllegatiController = __decorate([
|
|
219
|
+
(0, common_1.Controller)('allegati'),
|
|
220
|
+
__metadata("design:paramtypes", [AllegatiService_1.AllegatiService])
|
|
221
|
+
], AllegatiController);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class AllegatoDto {
|
|
2
|
+
id: number;
|
|
3
|
+
filename: string;
|
|
4
|
+
mimetype: string;
|
|
5
|
+
uploadDate: string;
|
|
6
|
+
codice?: string;
|
|
7
|
+
tipoCodice?: string;
|
|
8
|
+
ordine?: string;
|
|
9
|
+
descrizioneAllegato?: string;
|
|
10
|
+
dataInizioValidita?: string;
|
|
11
|
+
dataFineValidita?: string;
|
|
12
|
+
idTipoAllegato?: number;
|
|
13
|
+
riferimentoDocumento?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
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.AllegatoDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class AllegatoDto {
|
|
16
|
+
}
|
|
17
|
+
exports.AllegatoDto = AllegatoDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({
|
|
20
|
+
description: 'ID univoco dell\'allegato',
|
|
21
|
+
example: 1,
|
|
22
|
+
}),
|
|
23
|
+
(0, class_validator_1.IsNumber)(),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], AllegatoDto.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, swagger_1.ApiProperty)({
|
|
28
|
+
description: 'Nome originale del file caricato',
|
|
29
|
+
example: 'documento.pdf',
|
|
30
|
+
}),
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
(0, class_validator_1.IsNotEmpty)({ message: "Il nome file è obbligatorio." }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], AllegatoDto.prototype, "filename", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiProperty)({
|
|
37
|
+
description: 'Tipo MIME del file',
|
|
38
|
+
example: 'application/pdf',
|
|
39
|
+
}),
|
|
40
|
+
(0, class_validator_1.IsString)(),
|
|
41
|
+
(0, class_validator_1.IsNotEmpty)({ message: "Il tipo MIME è obbligatorio." }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], AllegatoDto.prototype, "mimetype", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, swagger_1.ApiProperty)({
|
|
46
|
+
description: 'Data di caricamento del file in formato ISO',
|
|
47
|
+
example: '2025-04-27T12:00:00Z',
|
|
48
|
+
}),
|
|
49
|
+
(0, class_validator_1.IsString)(),
|
|
50
|
+
(0, class_validator_1.IsNotEmpty)({ message: "La data di upload è obbligatoria." }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], AllegatoDto.prototype, "uploadDate", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, swagger_1.ApiProperty)({
|
|
55
|
+
description: 'Codice incrementale',
|
|
56
|
+
example: '1',
|
|
57
|
+
}),
|
|
58
|
+
(0, class_validator_1.IsString)(),
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], AllegatoDto.prototype, "codice", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, swagger_1.ApiProperty)({
|
|
64
|
+
description: 'Tipo del codice fornito',
|
|
65
|
+
example: 'CF',
|
|
66
|
+
}),
|
|
67
|
+
(0, class_validator_1.IsString)(),
|
|
68
|
+
(0, class_validator_1.IsOptional)(),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], AllegatoDto.prototype, "tipoCodice", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, swagger_1.ApiProperty)({
|
|
73
|
+
description: 'Numero o valore usato per ordinare o identificare la sequenza degli allegati',
|
|
74
|
+
example: '1',
|
|
75
|
+
}),
|
|
76
|
+
(0, class_validator_1.IsString)(),
|
|
77
|
+
(0, class_validator_1.IsOptional)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], AllegatoDto.prototype, "ordine", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, swagger_1.ApiProperty)({
|
|
82
|
+
description: 'Descrizione testuale dell\'allegato',
|
|
83
|
+
example: 'Documento di identità fronte',
|
|
84
|
+
}),
|
|
85
|
+
(0, class_validator_1.IsString)(),
|
|
86
|
+
(0, class_validator_1.IsOptional)(),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], AllegatoDto.prototype, "descrizioneAllegato", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, swagger_1.ApiProperty)({
|
|
91
|
+
description: 'Data di inizio validità del documento',
|
|
92
|
+
example: '2024-01-01',
|
|
93
|
+
}),
|
|
94
|
+
(0, class_validator_1.IsString)(),
|
|
95
|
+
(0, class_validator_1.IsOptional)(),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], AllegatoDto.prototype, "dataInizioValidita", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, swagger_1.ApiProperty)({
|
|
100
|
+
description: 'Data di fine validità del documento',
|
|
101
|
+
example: '2025-01-01',
|
|
102
|
+
}),
|
|
103
|
+
(0, class_validator_1.IsString)(),
|
|
104
|
+
(0, class_validator_1.IsOptional)(),
|
|
105
|
+
__metadata("design:type", String)
|
|
106
|
+
], AllegatoDto.prototype, "dataFineValidita", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, swagger_1.ApiProperty)({
|
|
109
|
+
description: 'ID del tipo di allegato',
|
|
110
|
+
example: 3,
|
|
111
|
+
}),
|
|
112
|
+
(0, class_validator_1.IsNumber)(),
|
|
113
|
+
(0, class_validator_1.IsOptional)(),
|
|
114
|
+
__metadata("design:type", Number)
|
|
115
|
+
], AllegatoDto.prototype, "idTipoAllegato", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, swagger_1.ApiProperty)({
|
|
118
|
+
description: 'Riferimento esterno o identificativo del documento',
|
|
119
|
+
example: 'PRAT-2024-0001',
|
|
120
|
+
}),
|
|
121
|
+
(0, class_validator_1.IsString)(),
|
|
122
|
+
(0, class_validator_1.IsOptional)(),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], AllegatoDto.prototype, "riferimentoDocumento", void 0);
|
|
@@ -0,0 +1,38 @@
|
|
|
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.BaseResponse = exports.Status = 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
|
+
class Status {
|
|
17
|
+
}
|
|
18
|
+
exports.Status = Status;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiProperty)({ example: '0', description: 'Codice di errore, "0" se tutto ok' }),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], Status.prototype, "errorCode", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({ example: 'Success', description: 'Descrizione dell\'errore o successo' }),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Status.prototype, "errorDescription", void 0);
|
|
29
|
+
class BaseResponse {
|
|
30
|
+
}
|
|
31
|
+
exports.BaseResponse = BaseResponse;
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ type: Status }),
|
|
34
|
+
(0, class_validator_1.ValidateNested)(),
|
|
35
|
+
(0, class_transformer_1.Type)(() => Status),
|
|
36
|
+
(0, class_validator_1.IsObject)(),
|
|
37
|
+
__metadata("design:type", Status)
|
|
38
|
+
], BaseResponse.prototype, "Status", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class UploadSingleFileRequest {
|
|
2
|
+
codice: string;
|
|
3
|
+
tipoCodice: string;
|
|
4
|
+
ordine: string;
|
|
5
|
+
descrizioneAllegato: string;
|
|
6
|
+
nomeFile: string;
|
|
7
|
+
dataInizioValidita: string;
|
|
8
|
+
dataFineValidita: string;
|
|
9
|
+
idTipoAllegato: number;
|
|
10
|
+
riferimentoDocumento: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.UploadSingleFileRequest = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
class UploadSingleFileRequest {
|
|
15
|
+
}
|
|
16
|
+
exports.UploadSingleFileRequest = UploadSingleFileRequest;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, swagger_1.ApiProperty)({
|
|
19
|
+
description: 'Codice identificativo del soggetto o dell’entità (es. codice fiscale, matricola, ecc.)',
|
|
20
|
+
example: 'RSSMRA85M01H501Z',
|
|
21
|
+
}),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], UploadSingleFileRequest.prototype, "codice", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({
|
|
26
|
+
description: 'Tipo del codice fornito (es. CF, PI, MATRICOLA)',
|
|
27
|
+
example: 'CF',
|
|
28
|
+
}),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], UploadSingleFileRequest.prototype, "tipoCodice", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({
|
|
33
|
+
description: 'Numero o valore usato per ordinare o identificare la sequenza degli allegati',
|
|
34
|
+
example: '1',
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], UploadSingleFileRequest.prototype, "ordine", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, swagger_1.ApiProperty)({
|
|
40
|
+
description: 'Descrizione testuale dell’allegato',
|
|
41
|
+
example: 'Documento di identità fronte',
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], UploadSingleFileRequest.prototype, "descrizioneAllegato", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)({
|
|
47
|
+
description: 'Nome del file originale caricato',
|
|
48
|
+
example: 'documento_identita.pdf',
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], UploadSingleFileRequest.prototype, "nomeFile", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiProperty)({
|
|
54
|
+
description: 'Data di inizio validità del documento (formato ISO)',
|
|
55
|
+
example: '2024-01-01',
|
|
56
|
+
}),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], UploadSingleFileRequest.prototype, "dataInizioValidita", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, swagger_1.ApiProperty)({
|
|
61
|
+
description: 'Data di fine validità del documento (formato ISO)',
|
|
62
|
+
example: '2025-01-01',
|
|
63
|
+
}),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], UploadSingleFileRequest.prototype, "dataFineValidita", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, swagger_1.ApiProperty)({
|
|
68
|
+
description: 'ID del tipo di allegato secondo tabella master (FK)',
|
|
69
|
+
example: 3,
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", Number)
|
|
72
|
+
], UploadSingleFileRequest.prototype, "idTipoAllegato", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, swagger_1.ApiProperty)({
|
|
75
|
+
description: 'Riferimento esterno o identificativo del documento (es. numero pratica)',
|
|
76
|
+
example: 'PRAT-2024-0001',
|
|
77
|
+
}),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], UploadSingleFileRequest.prototype, "riferimentoDocumento", void 0);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AllegatoDto"), exports);
|
|
18
|
+
__exportStar(require("./responses/DownloadAllegatoResponseDto"), exports);
|
|
19
|
+
__exportStar(require("./responses/UploadAllegatoResponseDto"), exports);
|