@programisto/edrm-storage 1.0.1 → 1.0.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/bin/www.js +1 -1
- package/dist/modules/edrm-storage/models/file.model.d.ts +1 -1
- package/dist/modules/edrm-storage/models/file.model.js +1 -1
- package/dist/modules/edrm-storage/routes/edrm-storage.router.d.ts +1 -1
- package/dist/modules/edrm-storage/routes/edrm-storage.router.js +6 -7
- package/dist/modules/edrm-storage/services/edrm-storage.service.js +1 -1
- package/package.json +2 -2
package/dist/bin/www.js
CHANGED
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-use-before-define */
|
|
11
|
-
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance
|
|
11
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
|
|
12
12
|
// Enums pour les statuts de fichiers
|
|
13
13
|
export var FileStatus;
|
|
14
14
|
(function (FileStatus) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnduranceRouter } from '@programisto/endurance
|
|
1
|
+
import { EnduranceRouter } from '@programisto/endurance';
|
|
2
2
|
import { EdrmStorageService } from '../services/edrm-storage.service.js';
|
|
3
3
|
class EdrmStorageRouter extends EnduranceRouter {
|
|
4
4
|
storageService;
|
|
@@ -9,14 +9,13 @@ class EdrmStorageRouter extends EnduranceRouter {
|
|
|
9
9
|
setupRoutes() {
|
|
10
10
|
const adminOptions = {
|
|
11
11
|
requireAuth: true,
|
|
12
|
-
permissions: ['
|
|
12
|
+
permissions: ['Admin_ManageFiles']
|
|
13
13
|
};
|
|
14
14
|
const userOptions = {
|
|
15
|
-
requireAuth: true
|
|
16
|
-
permissions: ['file:read']
|
|
15
|
+
requireAuth: true
|
|
17
16
|
};
|
|
18
17
|
// Routes publiques pour l'initialisation d'upload
|
|
19
|
-
this.post('/files/init',
|
|
18
|
+
this.post('/files/init', userOptions, async (req, res) => {
|
|
20
19
|
try {
|
|
21
20
|
const { originalName, mimeType, size, tenantId, entityName, entityId, provider = 'S3', metadata, tags } = req.body;
|
|
22
21
|
if (!originalName || !mimeType || !size || !tenantId || !entityName || !entityId) {
|
|
@@ -40,7 +39,7 @@ class EdrmStorageRouter extends EnduranceRouter {
|
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
41
|
// Finaliser un upload
|
|
43
|
-
this.post('/files/:fileId/complete',
|
|
42
|
+
this.post('/files/:fileId/complete', userOptions, async (req, res) => {
|
|
44
43
|
try {
|
|
45
44
|
const { fileId } = req.params;
|
|
46
45
|
const result = await this.storageService.completeUpload(fileId);
|
|
@@ -95,7 +94,7 @@ class EdrmStorageRouter extends EnduranceRouter {
|
|
|
95
94
|
}
|
|
96
95
|
});
|
|
97
96
|
// Lister les fichiers
|
|
98
|
-
this.get('/files',
|
|
97
|
+
this.get('/files', adminOptions, async (req, res) => {
|
|
99
98
|
try {
|
|
100
99
|
const { tenantId, entityName, entityId, status, page = 1, limit = 20 } = req.query;
|
|
101
100
|
const result = await this.storageService.listFiles(tenantId, entityName, entityId, status, parseInt(page), parseInt(limit));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { enduranceEmitter, enduranceEventTypes } from '@programisto/endurance
|
|
1
|
+
import { enduranceEmitter, enduranceEventTypes } from '@programisto/endurance';
|
|
2
2
|
import FileModel, { FileStatus, FileProvider, FileType } from '../models/file.model.js';
|
|
3
3
|
import { S3StorageProvider } from '../providers/s3-storage.provider.js';
|
|
4
4
|
import crypto from 'crypto';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@programisto/edrm-storage",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@aws-sdk/client-s3": "^3.879.0",
|
|
21
21
|
"@aws-sdk/s3-request-presigner": "^3.879.0",
|
|
22
|
-
"@programisto/endurance
|
|
22
|
+
"@programisto/endurance": "^1.0.2",
|
|
23
23
|
"aws-sdk": "^2.1692.0",
|
|
24
24
|
"debug": "^4.3.7",
|
|
25
25
|
"fs": "^0.0.1-security",
|