@programisto/edrm-storage 1.0.1 → 1.0.2

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.
@@ -9,14 +9,13 @@ class EdrmStorageRouter extends EnduranceRouter {
9
9
  setupRoutes() {
10
10
  const adminOptions = {
11
11
  requireAuth: true,
12
- permissions: ['admin', 'file:manage']
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', { requireAuth: true, permissions: ['file:upload'] }, async (req, res) => {
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', adminOptions, async (req, res) => {
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', userOptions, async (req, res) => {
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));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@programisto/edrm-storage",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },