@flusys/nestjs-storage 1.0.0-rc → 1.0.0

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.
Files changed (103) hide show
  1. package/README.md +44 -1
  2. package/cjs/config/index.js +0 -1
  3. package/cjs/config/storage.constants.js +0 -9
  4. package/cjs/controllers/upload.controller.js +12 -17
  5. package/cjs/docs/storage-swagger.config.js +24 -136
  6. package/cjs/dtos/file-manager.dto.js +65 -32
  7. package/cjs/dtos/folder.dto.js +15 -9
  8. package/cjs/dtos/storage-config.dto.js +5 -86
  9. package/cjs/dtos/upload.dto.js +17 -17
  10. package/cjs/entities/file-manager-with-company.entity.js +3 -4
  11. package/cjs/entities/file-manager.entity.js +71 -3
  12. package/cjs/entities/folder-with-company.entity.js +3 -4
  13. package/cjs/entities/folder.entity.js +19 -3
  14. package/cjs/entities/index.js +9 -10
  15. package/cjs/entities/storage-config-with-company.entity.js +3 -4
  16. package/cjs/entities/storage-config.entity.js +73 -3
  17. package/cjs/middlewares/file-serve.middleware.js +107 -100
  18. package/cjs/modules/storage.module.js +82 -136
  19. package/cjs/providers/azure-provider.optional.js +10 -38
  20. package/cjs/providers/local-provider.js +0 -43
  21. package/cjs/providers/s3-provider.optional.js +19 -40
  22. package/cjs/providers/storage-factory.service.js +54 -99
  23. package/cjs/providers/storage-provider.registry.js +8 -18
  24. package/cjs/services/file-manager.service.js +239 -337
  25. package/cjs/services/folder.service.js +3 -3
  26. package/cjs/services/index.js +1 -0
  27. package/cjs/{config → services}/storage-config.service.js +30 -79
  28. package/cjs/services/storage-datasource.provider.js +16 -26
  29. package/cjs/services/storage-provider-config.service.js +3 -3
  30. package/cjs/services/upload.service.js +33 -61
  31. package/cjs/utils/file-validator.util.js +54 -66
  32. package/cjs/utils/image-compressor.util.js +2 -5
  33. package/config/index.d.ts +0 -1
  34. package/config/storage.constants.d.ts +0 -6
  35. package/controllers/upload.controller.d.ts +1 -0
  36. package/dtos/file-manager.dto.d.ts +11 -3
  37. package/dtos/folder.dto.d.ts +3 -1
  38. package/dtos/storage-config.dto.d.ts +7 -11
  39. package/entities/file-manager-with-company.entity.d.ts +2 -2
  40. package/entities/file-manager.entity.d.ts +11 -2
  41. package/entities/folder-with-company.entity.d.ts +2 -2
  42. package/entities/folder.entity.d.ts +4 -2
  43. package/entities/index.d.ts +3 -4
  44. package/entities/storage-config-with-company.entity.d.ts +2 -2
  45. package/entities/storage-config.entity.d.ts +7 -2
  46. package/fesm/config/index.js +0 -1
  47. package/fesm/config/storage.constants.js +0 -6
  48. package/fesm/controllers/upload.controller.js +12 -17
  49. package/fesm/docs/storage-swagger.config.js +27 -142
  50. package/fesm/dtos/file-manager.dto.js +66 -33
  51. package/fesm/dtos/folder.dto.js +16 -10
  52. package/fesm/dtos/storage-config.dto.js +7 -88
  53. package/fesm/dtos/upload.dto.js +17 -18
  54. package/fesm/entities/file-manager-with-company.entity.js +3 -4
  55. package/fesm/entities/file-manager.entity.js +72 -4
  56. package/fesm/entities/folder-with-company.entity.js +3 -4
  57. package/fesm/entities/folder.entity.js +20 -4
  58. package/fesm/entities/index.js +4 -8
  59. package/fesm/entities/storage-config-with-company.entity.js +3 -4
  60. package/fesm/entities/storage-config.entity.js +74 -4
  61. package/fesm/middlewares/file-serve.middleware.js +107 -100
  62. package/fesm/modules/storage.module.js +83 -136
  63. package/fesm/providers/azure-provider.optional.js +11 -42
  64. package/fesm/providers/local-provider.js +0 -43
  65. package/fesm/providers/s3-provider.optional.js +20 -44
  66. package/fesm/providers/storage-factory.service.js +52 -97
  67. package/fesm/providers/storage-provider.registry.js +10 -20
  68. package/fesm/services/file-manager.service.js +237 -335
  69. package/fesm/services/folder.service.js +1 -1
  70. package/fesm/services/index.js +1 -0
  71. package/fesm/{config → services}/storage-config.service.js +30 -79
  72. package/fesm/services/storage-datasource.provider.js +16 -26
  73. package/fesm/services/storage-provider-config.service.js +1 -1
  74. package/fesm/services/upload.service.js +31 -59
  75. package/fesm/utils/file-validator.util.js +54 -66
  76. package/fesm/utils/image-compressor.util.js +2 -5
  77. package/interfaces/storage-config.interface.d.ts +1 -2
  78. package/interfaces/storage-module-options.interface.d.ts +0 -5
  79. package/middlewares/file-serve.middleware.d.ts +9 -1
  80. package/modules/storage.module.d.ts +1 -2
  81. package/package.json +3 -3
  82. package/providers/azure-provider.optional.d.ts +8 -6
  83. package/providers/local-provider.d.ts +0 -7
  84. package/providers/s3-provider.optional.d.ts +9 -7
  85. package/providers/storage-factory.service.d.ts +8 -9
  86. package/providers/storage-provider.registry.d.ts +4 -4
  87. package/services/file-manager.service.d.ts +21 -14
  88. package/services/folder.service.d.ts +4 -4
  89. package/services/index.d.ts +1 -0
  90. package/{config → services}/storage-config.service.d.ts +9 -10
  91. package/services/storage-datasource.provider.d.ts +3 -4
  92. package/services/storage-provider-config.service.d.ts +5 -6
  93. package/services/upload.service.d.ts +5 -5
  94. package/utils/file-validator.util.d.ts +3 -0
  95. package/cjs/entities/file-manager-base.entity.js +0 -115
  96. package/cjs/entities/folder-base.entity.js +0 -55
  97. package/cjs/entities/storage-config-base.entity.js +0 -93
  98. package/entities/file-manager-base.entity.d.ts +0 -13
  99. package/entities/folder-base.entity.d.ts +0 -5
  100. package/entities/storage-config-base.entity.d.ts +0 -9
  101. package/fesm/entities/file-manager-base.entity.js +0 -108
  102. package/fesm/entities/folder-base.entity.js +0 -48
  103. package/fesm/entities/storage-config-base.entity.js +0 -83
package/README.md CHANGED
@@ -9,8 +9,10 @@ This comprehensive guide covers the storage package - flexible file storage with
9
9
 
10
10
  - [Overview](#overview)
11
11
  - [Installation](#installation)
12
+ - [Constants](#constants)
12
13
  - [Package Architecture](#package-architecture)
13
14
  - [Module Setup](#module-setup)
15
+ - [Entities](#entities)
14
16
  - [Storage Providers](#storage-providers)
15
17
  - [Storage Configuration](#storage-configuration)
16
18
  - [File Manager](#file-manager)
@@ -62,6 +64,19 @@ npm install ssh2-sftp-client # For SFTP
62
64
 
63
65
  ---
64
66
 
67
+ ## Constants
68
+
69
+ ```typescript
70
+ // Injection Token
71
+ export const STORAGE_MODULE_OPTIONS = 'STORAGE_MODULE_OPTIONS';
72
+
73
+ // Default Configuration
74
+ export const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
75
+ export const DEFAULT_ALLOWED_FILE_TYPES = ['*/*']; // All file types
76
+ ```
77
+
78
+ ---
79
+
65
80
  ## Package Architecture
66
81
 
67
82
  ```
@@ -259,6 +274,34 @@ This ensures the API documentation accurately reflects the available fields base
259
274
 
260
275
  ---
261
276
 
277
+ ## Entities
278
+
279
+ ### Entity Groups
280
+
281
+ ```typescript
282
+ // Core entities (no company feature)
283
+ export const StorageCoreEntities = [FileManager, Folder, StorageConfig];
284
+
285
+ // Company-specific entities
286
+ export const StorageCompanyEntities = [
287
+ FileManagerWithCompany,
288
+ FolderWithCompany,
289
+ StorageConfigWithCompany,
290
+ ];
291
+
292
+ // Helper function
293
+ export function getStorageEntitiesByConfig(enableCompanyFeature: boolean): any[] {
294
+ return enableCompanyFeature ? StorageCompanyEntities : StorageCoreEntities;
295
+ }
296
+
297
+ // Base type aliases for backwards compatibility
298
+ export { FileManager as FileManagerBase } from './file-manager.entity';
299
+ export { Folder as FolderBase } from './folder.entity';
300
+ export { StorageConfig as StorageConfigBase } from './storage-config.entity';
301
+ ```
302
+
303
+ ---
304
+
262
305
  ## Storage Providers
263
306
 
264
307
  ### Provider Types
@@ -1397,4 +1440,4 @@ The `@flusys/nestjs-storage` package provides:
1397
1440
 
1398
1441
  ---
1399
1442
 
1400
- **Last Updated:** 2026-02-18
1443
+ **Last Updated:** 2026-02-21
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  _export_star(require("./storage.constants"), exports);
6
- _export_star(require("./storage-config.service"), exports);
7
6
  function _export_star(from, to) {
8
7
  Object.keys(from).forEach(function(k) {
9
8
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -17,9 +17,6 @@ _export(exports, {
17
17
  get DEFAULT_MAX_FILE_SIZE () {
18
18
  return DEFAULT_MAX_FILE_SIZE;
19
19
  },
20
- get FILE_VALIDATION_MESSAGES () {
21
- return FILE_VALIDATION_MESSAGES;
22
- },
23
20
  get STORAGE_MODULE_OPTIONS () {
24
21
  return STORAGE_MODULE_OPTIONS;
25
22
  }
@@ -29,9 +26,3 @@ const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
29
26
  const DEFAULT_ALLOWED_FILE_TYPES = [
30
27
  '*/*'
31
28
  ]; // All file types
32
- const FILE_VALIDATION_MESSAGES = {
33
- FILE_TOO_LARGE: 'File size exceeds the maximum allowed size',
34
- INVALID_FILE_TYPE: 'File type is not allowed',
35
- NO_FILE_PROVIDED: 'No file was provided',
36
- UPLOAD_FAILED: 'File upload failed'
37
- };
@@ -44,35 +44,30 @@ function _ts_param(paramIndex, decorator) {
44
44
  };
45
45
  }
46
46
  let UploadController = class UploadController {
47
+ toFileUploadResponse(file) {
48
+ return {
49
+ size: this.uploadService.bytesToKb(file.size),
50
+ name: file.name,
51
+ key: file.key,
52
+ contentType: file.contentType,
53
+ location: file.location || 'local',
54
+ storageConfigId: file.storageConfigId || ''
55
+ };
56
+ }
47
57
  async uploadSingleFile(file, options, user) {
48
58
  const result = await this.uploadService.uploadSingleFile(file, options, user);
49
59
  return {
50
60
  success: true,
51
61
  message: 'File uploaded successfully',
52
- data: {
53
- size: this.uploadService.bytesToKb(result.size),
54
- name: result.name,
55
- key: result.key,
56
- contentType: result.contentType,
57
- location: result.location || 'local',
58
- storageConfigId: result.storageConfigId || ''
59
- }
62
+ data: this.toFileUploadResponse(result)
60
63
  };
61
64
  }
62
65
  async uploadMultipleFiles(files, options, user) {
63
66
  const uploadResponses = await this.uploadService.uploadMultipleFiles(files, options, user);
64
- const responseData = uploadResponses.map((file)=>({
65
- size: this.uploadService.bytesToKb(file.size),
66
- name: file.name,
67
- key: file.key,
68
- contentType: file.contentType,
69
- location: file.location || 'local',
70
- storageConfigId: file.storageConfigId || ''
71
- }));
72
67
  return {
73
68
  success: true,
74
69
  message: 'Files uploaded successfully',
75
- data: responseData
70
+ data: uploadResponses.map((file)=>this.toFileUploadResponse(file))
76
71
  };
77
72
  }
78
73
  async deleteSingleFile(dto, user) {
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "storageSwaggerConfig", {
8
8
  return storageSwaggerConfig;
9
9
  }
10
10
  });
11
- /** Schema properties to exclude when company feature is disabled */ const COMPANY_SCHEMA_EXCLUSIONS = [
11
+ const COMPANY_SCHEMA_EXCLUSIONS = [
12
12
  {
13
13
  schemaName: 'FileManagerResponseDto',
14
14
  properties: [
@@ -28,120 +28,18 @@ Object.defineProperty(exports, "storageSwaggerConfig", {
28
28
  ]
29
29
  }
30
30
  ];
31
- function storageSwaggerConfig(bootstrapConfig) {
32
- const enableCompanyFeature = bootstrapConfig?.enableCompanyFeature ?? true;
33
- return {
34
- title: 'Storage API',
35
- description: enableCompanyFeature ? `
36
- # Storage Management API
37
-
38
- Complete file storage and management system with multi-tenant support.
39
-
40
- ## Features
41
-
42
- ### 📁 File Management
43
- - Upload single or multiple files
44
- - Download files with presigned URLs
45
- - Delete files (single or batch)
46
- - File metadata management
47
- - Automatic compression and optimization
48
- - **Company isolation**
49
-
50
- ### 🗂️ Folder Company
51
- - Create folder hierarchies
52
- - Organize files by folders
53
- - **Company-level permissions**
54
- - Automatic context filtering
55
-
56
- ### ⚙️ Storage Configuration
57
- - Multiple storage providers (AWS S3, Azure, SFTP, Local)
58
- - Provider-specific configurations
59
- - Default storage settings
60
- - Dynamic provider switching
61
-
62
- ### 🔒 Security
63
- - JWT authentication required
64
- - **Company isolation**
65
- - File access control
66
- - Presigned URL generation
67
-
68
- ## Storage Providers
69
-
70
- ### AWS S3
71
- - Scalable cloud storage
72
- - Automatic redundancy
73
- - Global CDN integration
74
-
75
- ### Azure Blob Storage
76
- - Microsoft Azure integration
77
- - Geo-redundant storage
78
- - Advanced security features
79
-
80
- ### SFTP
81
- - Secure file transfer
82
- - Legacy system integration
83
- - Custom server support
84
-
85
- ### Local Storage
86
- - Same-server storage
87
- - Fast access
88
- - No external dependencies
89
-
31
+ function buildDescription(enableCompanyFeature) {
32
+ const companyIsolation = enableCompanyFeature ? '\n- **Company isolation**' : '';
33
+ const companyPermissions = enableCompanyFeature ? '\n- **Company-level permissions**' : '';
34
+ const multiTenantSection = enableCompanyFeature ? `
90
35
  ## Multi-Tenant Support
91
36
 
92
37
  Files are automatically isolated by:
93
38
  - **Company ID**: Company-level storage
94
39
 
95
40
  All queries automatically filter by current user's company context.
96
-
97
- ## File Validation
98
-
99
- ### Size Limits
100
- Configure maximum file size per upload (default: 10MB)
101
-
102
- ### File Types
103
- Restrict allowed file types (default: images, PDFs)
104
-
105
- ### Image Compression
106
- - Automatic image optimization
107
- - Format conversion (JPEG, PNG, WebP, AVIF)
108
- - Resize to maximum dimensions
109
- - Quality control
110
-
111
- ## Response Format
112
-
113
- All endpoints return standardized responses with success status, data, message, and timestamp.
114
-
115
- ## Error Handling
116
-
117
- Errors return structured responses with success false, error message, error code, and timestamp.
118
-
119
- ## Common Error Codes
120
-
121
- - **400 Bad Request**: Invalid input data
122
- - **401 Unauthorized**: Missing or invalid authentication
123
- - **403 Forbidden**: Insufficient permissions
124
- - **404 Not Found**: Resource not found
125
- - **413 Payload Too Large**: File exceeds size limit
126
- - **415 Unsupported Media Type**: File type not allowed
127
- - **500 Internal Server Error**: Server error
128
-
129
- ## Getting Started
130
-
131
- 1. **Authenticate**: Obtain JWT token from /auth/login
132
- 2. **Configure Storage**: Create storage configuration via /storage/storage-config/insert
133
- 3. **Create Folders**: Organize files with /storage/folder/insert
134
- 4. **Upload Files**: Upload files via /storage/upload/single-file
135
- 5. **Manage Files**: Track uploads in /storage/file-manager
136
-
137
- ## API Endpoints
138
-
139
- All storage endpoints are prefixed with \`/storage\`:
140
- - \`/storage/file-manager/*\` - File metadata management
141
- - \`/storage/folder/*\` - Folder organization
142
- - \`/storage/storage-config/*\` - Storage configuration
143
- - \`/storage/upload/*\` - File upload/download
144
-
41
+ ` : '';
42
+ const examplesSection = enableCompanyFeature ? `
145
43
  ## Examples
146
44
 
147
45
  ### Upload a File
@@ -155,27 +53,11 @@ POST /storage/file-manager/get-all with JSON body containing page and pageSize p
155
53
  ### Create Folder
156
54
 
157
55
  POST /storage/folder/insert with JSON body containing folder name
158
-
159
- ## Best Practices
160
-
161
- 1. **Always authenticate**: Include JWT token in Authorization header
162
- 2. **Use folders**: Organize files hierarchically
163
- 3. **Check file size**: Validate before upload
164
- 4. **Handle errors**: Implement proper error handling
165
- 5. **Clean up**: Delete unused files regularly
166
- 6. **Use presigned URLs**: Generate temporary URLs for file access
167
- 7. **Compress images**: Enable compression for faster loading
168
-
169
- ## Rate Limiting
170
-
171
- All endpoints are rate-limited to prevent abuse. Default limits:
172
- - **Upload**: 100 requests per hour
173
- - **Download**: 1000 requests per hour
174
- - **Delete**: 50 requests per hour
175
- ` : `
56
+ ` : '';
57
+ return `
176
58
  # Storage Management API
177
59
 
178
- Complete file storage and management system.
60
+ Complete file storage and management system${enableCompanyFeature ? ' with multi-tenant support' : ''}.
179
61
 
180
62
  ## Features
181
63
 
@@ -184,12 +66,12 @@ Complete file storage and management system.
184
66
  - Download files with presigned URLs
185
67
  - Delete files (single or batch)
186
68
  - File metadata management
187
- - Automatic compression and optimization
69
+ - Automatic compression and optimization${companyIsolation}
188
70
 
189
- ### 🗂️ Folder Company
71
+ ### 🗂️ Folder Organization
190
72
  - Create folder hierarchies
191
- - Organize files by folders
192
- - Folder-level company
73
+ - Organize files by folders${companyPermissions}
74
+ - Automatic context filtering
193
75
 
194
76
  ### ⚙️ Storage Configuration
195
77
  - Multiple storage providers (AWS S3, Azure, SFTP, Local)
@@ -198,7 +80,7 @@ Complete file storage and management system.
198
80
  - Dynamic provider switching
199
81
 
200
82
  ### 🔒 Security
201
- - JWT authentication required
83
+ - JWT authentication required${companyIsolation}
202
84
  - File access control
203
85
  - Presigned URL generation
204
86
 
@@ -223,7 +105,7 @@ Complete file storage and management system.
223
105
  - Same-server storage
224
106
  - Fast access
225
107
  - No external dependencies
226
-
108
+ ${multiTenantSection}
227
109
  ## File Validation
228
110
 
229
111
  ### Size Limits
@@ -271,7 +153,7 @@ All storage endpoints are prefixed with \`/storage\`:
271
153
  - \`/storage/folder/*\` - Folder organization
272
154
  - \`/storage/storage-config/*\` - Storage configuration
273
155
  - \`/storage/upload/*\` - File upload/download
274
-
156
+ ${examplesSection}
275
157
  ## Best Practices
276
158
 
277
159
  1. **Always authenticate**: Include JWT token in Authorization header
@@ -288,7 +170,13 @@ All endpoints are rate-limited to prevent abuse. Default limits:
288
170
  - **Upload**: 100 requests per hour
289
171
  - **Download**: 1000 requests per hour
290
172
  - **Delete**: 50 requests per hour
291
- `,
173
+ `;
174
+ }
175
+ function storageSwaggerConfig(bootstrapConfig) {
176
+ const enableCompanyFeature = bootstrapConfig?.enableCompanyFeature ?? true;
177
+ return {
178
+ title: 'Storage API',
179
+ description: buildDescription(enableCompanyFeature),
292
180
  version: '1.0',
293
181
  path: 'api/docs/storage',
294
182
  bearerAuth: true,
@@ -82,7 +82,7 @@ _ts_decorate([
82
82
  ], CreateFileManagerDto.prototype, "key", void 0);
83
83
  _ts_decorate([
84
84
  (0, _swagger.ApiProperty)({
85
- description: 'Size of the FileManager item',
85
+ description: 'Size of the file in bytes',
86
86
  example: '1024'
87
87
  }),
88
88
  (0, _classvalidator.IsNotEmpty)(),
@@ -91,7 +91,7 @@ _ts_decorate([
91
91
  ], CreateFileManagerDto.prototype, "size", void 0);
92
92
  _ts_decorate([
93
93
  (0, _swagger.ApiProperty)({
94
- description: 'mime type of file',
94
+ description: 'MIME type of file',
95
95
  example: 'image/jpeg'
96
96
  }),
97
97
  (0, _classvalidator.IsNotEmpty)(),
@@ -100,7 +100,7 @@ _ts_decorate([
100
100
  ], CreateFileManagerDto.prototype, "contentType", void 0);
101
101
  _ts_decorate([
102
102
  (0, _swagger.ApiProperty)({
103
- description: 'Indicates if the FileManager item is private',
103
+ description: 'Indicates if the file is private',
104
104
  example: true
105
105
  }),
106
106
  (0, _classvalidator.IsNotEmpty)(),
@@ -108,21 +108,21 @@ _ts_decorate([
108
108
  _ts_metadata("design:type", Boolean)
109
109
  ], CreateFileManagerDto.prototype, "isPrivate", void 0);
110
110
  _ts_decorate([
111
- (0, _swagger.ApiProperty)({
111
+ (0, _swagger.ApiPropertyOptional)({
112
112
  description: 'Folder ID (UUID)',
113
113
  example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
114
114
  }),
115
115
  (0, _classvalidator.IsOptional)(),
116
- (0, _classvalidator.IsString)(),
116
+ (0, _classvalidator.IsUUID)(),
117
117
  _ts_metadata("design:type", String)
118
118
  ], CreateFileManagerDto.prototype, "folderId", void 0);
119
119
  _ts_decorate([
120
120
  (0, _swagger.ApiPropertyOptional)({
121
- description: 'Storage configuration ID - if not provided, uses default',
121
+ description: 'Storage configuration ID',
122
122
  example: '123e4567-e89b-12d3-a456-426614174000'
123
123
  }),
124
124
  (0, _classvalidator.IsOptional)(),
125
- (0, _classvalidator.IsString)(),
125
+ (0, _classvalidator.IsUUID)(),
126
126
  _ts_metadata("design:type", String)
127
127
  ], CreateFileManagerDto.prototype, "storageConfigId", void 0);
128
128
  _ts_decorate([
@@ -133,7 +133,7 @@ _ts_decorate([
133
133
  }),
134
134
  (0, _classvalidator.IsOptional)(),
135
135
  (0, _classvalidator.IsEnum)(_enums.FileLocationEnum),
136
- _ts_metadata("design:type", typeof _enums.FileLocationEnum === "undefined" ? Object : _enums.FileLocationEnum)
136
+ _ts_metadata("design:type", String)
137
137
  ], CreateFileManagerDto.prototype, "location", void 0);
138
138
  let UpdateFileManagerDto = class UpdateFileManagerDto extends (0, _swagger.PartialType)(CreateFileManagerDto) {
139
139
  constructor(...args){
@@ -145,19 +145,63 @@ _ts_decorate([
145
145
  description: 'Unique identifier of the file',
146
146
  example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
147
147
  }),
148
+ (0, _classvalidator.IsUUID)(),
148
149
  (0, _classvalidator.IsNotEmpty)(),
149
- (0, _classvalidator.IsString)(),
150
150
  _ts_metadata("design:type", String)
151
151
  ], UpdateFileManagerDto.prototype, "id", void 0);
152
- let FileManagerResponseDto = class FileManagerResponseDto extends UpdateFileManagerDto {
153
- constructor(...args){
154
- super(...args), _define_property(this, "providerName", void 0);
152
+ let FileManagerResponseDto = class FileManagerResponseDto {
153
+ constructor(){
154
+ _define_property(this, "id", void 0);
155
+ _define_property(this, "name", void 0);
156
+ _define_property(this, "key", void 0);
157
+ _define_property(this, "size", void 0);
158
+ _define_property(this, "contentType", void 0);
159
+ _define_property(this, "isPrivate", void 0);
160
+ _define_property(this, "folderId", void 0);
161
+ _define_property(this, "storageConfigId", void 0);
162
+ _define_property(this, "location", void 0);
163
+ _define_property(this, "providerName", void 0);
155
164
  }
156
165
  };
166
+ _ts_decorate([
167
+ (0, _swagger.ApiProperty)(),
168
+ _ts_metadata("design:type", String)
169
+ ], FileManagerResponseDto.prototype, "id", void 0);
170
+ _ts_decorate([
171
+ (0, _swagger.ApiProperty)(),
172
+ _ts_metadata("design:type", String)
173
+ ], FileManagerResponseDto.prototype, "name", void 0);
174
+ _ts_decorate([
175
+ (0, _swagger.ApiProperty)(),
176
+ _ts_metadata("design:type", String)
177
+ ], FileManagerResponseDto.prototype, "key", void 0);
178
+ _ts_decorate([
179
+ (0, _swagger.ApiProperty)(),
180
+ _ts_metadata("design:type", String)
181
+ ], FileManagerResponseDto.prototype, "size", void 0);
182
+ _ts_decorate([
183
+ (0, _swagger.ApiProperty)(),
184
+ _ts_metadata("design:type", String)
185
+ ], FileManagerResponseDto.prototype, "contentType", void 0);
186
+ _ts_decorate([
187
+ (0, _swagger.ApiProperty)(),
188
+ _ts_metadata("design:type", Boolean)
189
+ ], FileManagerResponseDto.prototype, "isPrivate", void 0);
190
+ _ts_decorate([
191
+ (0, _swagger.ApiPropertyOptional)(),
192
+ _ts_metadata("design:type", String)
193
+ ], FileManagerResponseDto.prototype, "folderId", void 0);
194
+ _ts_decorate([
195
+ (0, _swagger.ApiPropertyOptional)(),
196
+ _ts_metadata("design:type", String)
197
+ ], FileManagerResponseDto.prototype, "storageConfigId", void 0);
198
+ _ts_decorate([
199
+ (0, _swagger.ApiPropertyOptional)(),
200
+ _ts_metadata("design:type", String)
201
+ ], FileManagerResponseDto.prototype, "location", void 0);
157
202
  _ts_decorate([
158
203
  (0, _swagger.ApiPropertyOptional)({
159
- example: 'My S3 Storage',
160
- description: 'Name of the storage configuration/provider'
204
+ description: 'Name of the storage provider'
161
205
  }),
162
206
  _ts_metadata("design:type", String)
163
207
  ], FileManagerResponseDto.prototype, "providerName", void 0);
@@ -170,8 +214,8 @@ _ts_decorate([
170
214
  (0, _swagger.ApiProperty)({
171
215
  example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
172
216
  }),
217
+ (0, _classvalidator.IsUUID)(),
173
218
  (0, _classvalidator.IsNotEmpty)(),
174
- (0, _classvalidator.IsString)(),
175
219
  _ts_metadata("design:type", String)
176
220
  ], GetFilesRequestDto.prototype, "id", void 0);
177
221
  let FilesResponseDto = class FilesResponseDto {
@@ -186,47 +230,36 @@ let FilesResponseDto = class FilesResponseDto {
186
230
  }
187
231
  };
188
232
  _ts_decorate([
189
- (0, _swagger.ApiProperty)({
190
- example: 'file123.jpg'
191
- }),
233
+ (0, _swagger.ApiProperty)(),
192
234
  _ts_metadata("design:type", String)
193
235
  ], FilesResponseDto.prototype, "id", void 0);
194
236
  _ts_decorate([
195
- (0, _swagger.ApiProperty)({
196
- example: 'file123.jpg'
197
- }),
237
+ (0, _swagger.ApiProperty)(),
198
238
  _ts_metadata("design:type", String)
199
239
  ], FilesResponseDto.prototype, "name", void 0);
200
240
  _ts_decorate([
201
- (0, _swagger.ApiProperty)({
202
- example: 'image/jpeg'
203
- }),
241
+ (0, _swagger.ApiProperty)(),
204
242
  _ts_metadata("design:type", String)
205
243
  ], FilesResponseDto.prototype, "contentType", void 0);
206
244
  _ts_decorate([
207
- (0, _swagger.ApiProperty)({
208
- example: 'https://example.com/file123.jpg'
209
- }),
245
+ (0, _swagger.ApiProperty)(),
210
246
  _ts_metadata("design:type", String)
211
247
  ], FilesResponseDto.prototype, "url", void 0);
212
248
  _ts_decorate([
213
249
  (0, _swagger.ApiPropertyOptional)({
214
- example: 'local',
215
- description: 'Storage provider type (local, aws, azure, sftp)'
250
+ description: 'Storage provider type'
216
251
  }),
217
252
  _ts_metadata("design:type", String)
218
253
  ], FilesResponseDto.prototype, "location", void 0);
219
254
  _ts_decorate([
220
255
  (0, _swagger.ApiPropertyOptional)({
221
- example: '123e4567-e89b-12d3-a456-426614174000',
222
256
  description: 'Storage configuration ID'
223
257
  }),
224
258
  _ts_metadata("design:type", String)
225
259
  ], FilesResponseDto.prototype, "storageConfigId", void 0);
226
260
  _ts_decorate([
227
261
  (0, _swagger.ApiPropertyOptional)({
228
- example: 'My S3 Storage',
229
- description: 'Name of the storage configuration/provider'
262
+ description: 'Name of the storage provider'
230
263
  }),
231
264
  _ts_metadata("design:type", String)
232
265
  ], FilesResponseDto.prototype, "providerName", void 0);
@@ -67,20 +67,26 @@ _ts_decorate([
67
67
  description: 'Unique identifier of the folder',
68
68
  example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
69
69
  }),
70
+ (0, _classvalidator.IsUUID)(),
70
71
  (0, _classvalidator.IsNotEmpty)(),
71
72
  _ts_metadata("design:type", String)
72
73
  ], UpdateFolderDto.prototype, "id", void 0);
73
- let FolderResponseDto = class FolderResponseDto extends UpdateFolderDto {
74
- constructor(...args){
75
- super(...args), _define_property(this, "slug", void 0);
74
+ let FolderResponseDto = class FolderResponseDto {
75
+ constructor(){
76
+ _define_property(this, "id", void 0);
77
+ _define_property(this, "name", void 0);
78
+ _define_property(this, "slug", void 0);
76
79
  }
77
80
  };
78
81
  _ts_decorate([
79
- (0, _swagger.ApiProperty)({
80
- description: 'Name of the folder',
81
- example: 'Invoices'
82
- }),
83
- (0, _classvalidator.IsNotEmpty)(),
84
- (0, _classvalidator.IsString)(),
82
+ (0, _swagger.ApiProperty)(),
83
+ _ts_metadata("design:type", String)
84
+ ], FolderResponseDto.prototype, "id", void 0);
85
+ _ts_decorate([
86
+ (0, _swagger.ApiProperty)(),
87
+ _ts_metadata("design:type", String)
88
+ ], FolderResponseDto.prototype, "name", void 0);
89
+ _ts_decorate([
90
+ (0, _swagger.ApiProperty)(),
85
91
  _ts_metadata("design:type", String)
86
92
  ], FolderResponseDto.prototype, "slug", void 0);