@flusys/nestjs-storage 1.0.0-rc → 2.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 (102) 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 +64 -31
  7. package/cjs/dtos/folder.dto.js +15 -9
  8. package/cjs/dtos/storage-config.dto.js +4 -85
  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 +74 -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 +10 -1
  37. package/dtos/folder.dto.d.ts +3 -1
  38. package/dtos/storage-config.dto.d.ts +5 -8
  39. package/entities/file-manager-with-company.entity.d.ts +2 -2
  40. package/entities/file-manager.entity.d.ts +12 -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 +8 -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 +65 -32
  51. package/fesm/dtos/folder.dto.js +16 -10
  52. package/fesm/dtos/storage-config.dto.js +6 -87
  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 +75 -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-module-options.interface.d.ts +0 -5
  78. package/middlewares/file-serve.middleware.d.ts +9 -1
  79. package/modules/storage.module.d.ts +1 -2
  80. package/package.json +3 -3
  81. package/providers/azure-provider.optional.d.ts +8 -6
  82. package/providers/local-provider.d.ts +0 -7
  83. package/providers/s3-provider.optional.d.ts +9 -7
  84. package/providers/storage-factory.service.d.ts +8 -9
  85. package/providers/storage-provider.registry.d.ts +4 -4
  86. package/services/file-manager.service.d.ts +21 -14
  87. package/services/folder.service.d.ts +4 -4
  88. package/services/index.d.ts +1 -0
  89. package/{config → services}/storage-config.service.d.ts +9 -10
  90. package/services/storage-datasource.provider.d.ts +3 -4
  91. package/services/storage-provider-config.service.d.ts +4 -4
  92. package/services/upload.service.d.ts +3 -2
  93. package/utils/file-validator.util.d.ts +3 -0
  94. package/cjs/entities/file-manager-base.entity.js +0 -115
  95. package/cjs/entities/folder-base.entity.js +0 -55
  96. package/cjs/entities/storage-config-base.entity.js +0 -93
  97. package/entities/file-manager-base.entity.d.ts +0 -13
  98. package/entities/folder-base.entity.d.ts +0 -5
  99. package/entities/storage-config-base.entity.d.ts +0 -9
  100. package/fesm/entities/file-manager-base.entity.js +0 -108
  101. package/fesm/entities/folder-base.entity.js +0 -48
  102. package/fesm/entities/storage-config-base.entity.js +0 -83
@@ -22,8 +22,8 @@ function _ts_metadata(k, v) {
22
22
  }
23
23
  import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
24
24
  import { FileLocationEnum } from '../enums';
25
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
26
- import { IsBoolean, IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';
25
+ import { ApiProperty, ApiPropertyOptional, OmitType, PartialType } from '@nestjs/swagger';
26
+ import { IsBoolean, IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
27
27
  export class CreateStorageConfigDto {
28
28
  constructor(){
29
29
  _define_property(this, "name", void 0);
@@ -54,20 +54,6 @@ _ts_decorate([
54
54
  ], CreateStorageConfigDto.prototype, "storage", void 0);
55
55
  _ts_decorate([
56
56
  ApiProperty({
57
- type: 'object',
58
- properties: {
59
- region: {
60
- type: 'string',
61
- example: 'us-east-1',
62
- description: 'Cloud region'
63
- },
64
- bucket: {
65
- type: 'string',
66
- example: 'my-bucket',
67
- description: 'Bucket name'
68
- }
69
- },
70
- additionalProperties: true,
71
57
  description: 'Provider-specific configuration',
72
58
  example: {
73
59
  region: 'us-east-1',
@@ -96,86 +82,19 @@ _ts_decorate([
96
82
  IsOptional(),
97
83
  _ts_metadata("design:type", Boolean)
98
84
  ], CreateStorageConfigDto.prototype, "isDefault", void 0);
99
- export class UpdateStorageConfigDto {
100
- constructor(){
101
- _define_property(this, "id", void 0);
102
- _define_property(this, "name", void 0);
103
- _define_property(this, "storage", void 0);
104
- _define_property(this, "config", void 0);
105
- _define_property(this, "isActive", void 0);
106
- _define_property(this, "isDefault", void 0);
85
+ export class UpdateStorageConfigDto extends PartialType(OmitType(CreateStorageConfigDto, [])) {
86
+ constructor(...args){
87
+ super(...args), _define_property(this, "id", void 0);
107
88
  }
108
89
  }
109
90
  _ts_decorate([
110
91
  ApiProperty({
111
92
  example: '123e4567-e89b-12d3-a456-426614174000'
112
93
  }),
113
- IsString(),
94
+ IsUUID(),
114
95
  IsNotEmpty(),
115
96
  _ts_metadata("design:type", String)
116
97
  ], UpdateStorageConfigDto.prototype, "id", void 0);
117
- _ts_decorate([
118
- ApiPropertyOptional({
119
- example: 'Production AWS S3'
120
- }),
121
- IsString(),
122
- IsOptional(),
123
- MaxLength(255),
124
- _ts_metadata("design:type", String)
125
- ], UpdateStorageConfigDto.prototype, "name", void 0);
126
- _ts_decorate([
127
- ApiPropertyOptional({
128
- enum: FileLocationEnum,
129
- example: FileLocationEnum.AWS
130
- }),
131
- IsEnum(FileLocationEnum),
132
- IsOptional(),
133
- _ts_metadata("design:type", typeof FileLocationEnum === "undefined" ? Object : FileLocationEnum)
134
- ], UpdateStorageConfigDto.prototype, "storage", void 0);
135
- _ts_decorate([
136
- ApiPropertyOptional({
137
- type: 'object',
138
- properties: {
139
- region: {
140
- type: 'string',
141
- example: 'us-east-1',
142
- description: 'Cloud region'
143
- },
144
- bucket: {
145
- type: 'string',
146
- example: 'my-bucket',
147
- description: 'Bucket name'
148
- }
149
- },
150
- additionalProperties: true,
151
- description: 'Provider-specific configuration',
152
- example: {
153
- region: 'us-east-1',
154
- bucket: 'my-bucket'
155
- }
156
- }),
157
- IsObject(),
158
- IsOptional(),
159
- _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
160
- ], UpdateStorageConfigDto.prototype, "config", void 0);
161
- _ts_decorate([
162
- ApiPropertyOptional({
163
- example: true,
164
- description: 'Whether storage configuration is active'
165
- }),
166
- IsBoolean(),
167
- IsOptional(),
168
- _ts_metadata("design:type", Boolean)
169
- ], UpdateStorageConfigDto.prototype, "isActive", void 0);
170
- _ts_decorate([
171
- ApiPropertyOptional({
172
- example: false,
173
- description: 'Set as default storage configuration'
174
- }),
175
- IsBoolean(),
176
- IsOptional(),
177
- _ts_metadata("design:type", Boolean)
178
- ], UpdateStorageConfigDto.prototype, "isDefault", void 0);
179
98
  export class StorageConfigResponseDto extends IdentityResponseDto {
180
99
  constructor(...args){
181
100
  super(...args), _define_property(this, "name", void 0), _define_property(this, "storage", void 0), _define_property(this, "config", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isDefault", void 0);
@@ -23,7 +23,6 @@ function _ts_metadata(k, v) {
23
23
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
24
24
  import { IsArray, IsBoolean, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Matches, Max, Min } from 'class-validator';
25
25
  import { Type } from 'class-transformer';
26
- // Image format enum
27
26
  export var ImageFormat = /*#__PURE__*/ function(ImageFormat) {
28
27
  ImageFormat["ORIGINAL"] = "original";
29
28
  ImageFormat["JPEG"] = "jpeg";
@@ -40,7 +39,7 @@ export class DeleteSingleFileDto {
40
39
  _ts_decorate([
41
40
  ApiProperty({
42
41
  description: 'Key of the file to delete',
43
- example: '/uploads/some path'
42
+ example: '/uploads/some-path'
44
43
  }),
45
44
  IsNotEmpty(),
46
45
  IsString(),
@@ -48,7 +47,7 @@ _ts_decorate([
48
47
  ], DeleteSingleFileDto.prototype, "key", void 0);
49
48
  _ts_decorate([
50
49
  ApiPropertyOptional({
51
- description: 'Storage configuration ID (optional - uses default if not provided)',
50
+ description: 'Storage configuration ID',
52
51
  example: '123e4567-e89b-12d3-a456-426614174000'
53
52
  }),
54
53
  IsOptional(),
@@ -63,10 +62,10 @@ export class DeleteMultipleFileDto {
63
62
  }
64
63
  _ts_decorate([
65
64
  ApiProperty({
66
- description: 'Array of file Keys to delete',
65
+ description: 'Array of file keys to delete',
67
66
  example: [
68
- '/uploads/some path',
69
- 'aws key'
67
+ '/uploads/file1',
68
+ '/uploads/file2'
70
69
  ],
71
70
  type: [
72
71
  String
@@ -81,7 +80,7 @@ _ts_decorate([
81
80
  ], DeleteMultipleFileDto.prototype, "keys", void 0);
82
81
  _ts_decorate([
83
82
  ApiPropertyOptional({
84
- description: 'Storage configuration ID (optional - uses default if not provided)',
83
+ description: 'Storage configuration ID',
85
84
  example: '123e4567-e89b-12d3-a456-426614174000'
86
85
  }),
87
86
  IsOptional(),
@@ -101,7 +100,7 @@ export class UploadOptionsDto {
101
100
  }
102
101
  _ts_decorate([
103
102
  ApiPropertyOptional({
104
- description: 'Storage configuration ID (optional - uses default if not provided)',
103
+ description: 'Storage configuration ID',
105
104
  example: '123e4567-e89b-12d3-a456-426614174000'
106
105
  }),
107
106
  IsOptional(),
@@ -110,7 +109,7 @@ _ts_decorate([
110
109
  ], UploadOptionsDto.prototype, "storageConfigId", void 0);
111
110
  _ts_decorate([
112
111
  ApiPropertyOptional({
113
- description: 'Folder path where the file should be uploaded (e.g., "uploads/images").',
112
+ description: 'Folder path for upload',
114
113
  example: 'uploads/images'
115
114
  }),
116
115
  IsOptional(),
@@ -121,7 +120,7 @@ _ts_decorate([
121
120
  ], UploadOptionsDto.prototype, "folderPath", void 0);
122
121
  _ts_decorate([
123
122
  ApiPropertyOptional({
124
- description: 'Maximum width of the image in pixels (resize will preserve aspect ratio).',
123
+ description: 'Maximum width in pixels',
125
124
  example: 1280,
126
125
  minimum: 100,
127
126
  maximum: 10000,
@@ -136,7 +135,7 @@ _ts_decorate([
136
135
  ], UploadOptionsDto.prototype, "maxWidth", void 0);
137
136
  _ts_decorate([
138
137
  ApiPropertyOptional({
139
- description: 'Maximum height of the image in pixels (resize will preserve aspect ratio).',
138
+ description: 'Maximum height in pixels',
140
139
  example: 1280,
141
140
  minimum: 100,
142
141
  maximum: 10000,
@@ -151,7 +150,7 @@ _ts_decorate([
151
150
  ], UploadOptionsDto.prototype, "maxHeight", void 0);
152
151
  _ts_decorate([
153
152
  ApiPropertyOptional({
154
- description: 'Compression quality (1100). Higher means better quality but larger file size.',
153
+ description: 'Compression quality (1-100)',
155
154
  example: 85,
156
155
  minimum: 1,
157
156
  maximum: 100,
@@ -166,7 +165,7 @@ _ts_decorate([
166
165
  ], UploadOptionsDto.prototype, "quality", void 0);
167
166
  _ts_decorate([
168
167
  ApiPropertyOptional({
169
- description: 'Output format of the image. "original" keeps the source format.',
168
+ description: 'Output image format',
170
169
  enum: ImageFormat,
171
170
  default: "original"
172
171
  }),
@@ -176,7 +175,7 @@ _ts_decorate([
176
175
  ], UploadOptionsDto.prototype, "format", void 0);
177
176
  _ts_decorate([
178
177
  ApiPropertyOptional({
179
- description: 'Whether to compress the image or not.',
178
+ description: 'Whether to compress the image',
180
179
  example: true,
181
180
  default: true
182
181
  }),
@@ -203,7 +202,7 @@ _ts_decorate([
203
202
  ], FileUploadResponsePayloadDto.prototype, "name", void 0);
204
203
  _ts_decorate([
205
204
  ApiProperty({
206
- example: 'file123.jpg'
205
+ example: 'image/jpeg'
207
206
  }),
208
207
  _ts_metadata("design:type", String)
209
208
  ], FileUploadResponsePayloadDto.prototype, "contentType", void 0);
@@ -215,21 +214,21 @@ _ts_decorate([
215
214
  ], FileUploadResponsePayloadDto.prototype, "size", void 0);
216
215
  _ts_decorate([
217
216
  ApiProperty({
218
- example: 'file path or aws key'
217
+ example: 'uploads/file123.jpg'
219
218
  }),
220
219
  _ts_metadata("design:type", String)
221
220
  ], FileUploadResponsePayloadDto.prototype, "key", void 0);
222
221
  _ts_decorate([
223
222
  ApiProperty({
224
223
  example: 'local',
225
- description: 'Storage provider type (local, aws, azure, sftp)'
224
+ description: 'Storage provider type'
226
225
  }),
227
226
  _ts_metadata("design:type", String)
228
227
  ], FileUploadResponsePayloadDto.prototype, "location", void 0);
229
228
  _ts_decorate([
230
229
  ApiProperty({
231
230
  example: '123e4567-e89b-12d3-a456-426614174000',
232
- description: 'Storage configuration ID used for this upload'
231
+ description: 'Storage configuration ID'
233
232
  }),
234
233
  _ts_metadata("design:type", String)
235
234
  ], FileUploadResponsePayloadDto.prototype, "storageConfigId", void 0);
@@ -21,11 +21,10 @@ function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
23
  import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
24
- import { FileManagerBase } from './file-manager-base.entity';
25
- export class FileManagerWithCompany extends FileManagerBase {
24
+ import { FileManager } from './file-manager.entity';
25
+ export class FileManagerWithCompany extends FileManager {
26
26
  constructor(...args){
27
- super(...args), // Company ID - used when company feature is enabled
28
- _define_property(this, "companyId", void 0), _define_property(this, "folder", void 0);
27
+ super(...args), _define_property(this, "companyId", void 0);
29
28
  }
30
29
  }
31
30
  _ts_decorate([
@@ -20,13 +20,81 @@ function _ts_decorate(decorators, target, key, desc) {
20
20
  function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
- import { Entity, JoinColumn, ManyToOne } from 'typeorm';
24
- import { FileManagerBase } from './file-manager-base.entity';
25
- export class FileManager extends FileManagerBase {
23
+ import { Identity } from '@flusys/nestjs-shared/entities';
24
+ import { FileLocationEnum } from '../enums';
25
+ import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
26
+ export class FileManager extends Identity {
26
27
  constructor(...args){
27
- super(...args), _define_property(this, "folder", void 0);
28
+ super(...args), _define_property(this, "name", void 0), _define_property(this, "contentType", void 0), _define_property(this, "size", void 0), _define_property(this, "key", void 0), _define_property(this, "url", void 0), _define_property(this, "location", void 0), _define_property(this, "storageConfigId", void 0), _define_property(this, "expiresAt", null), _define_property(this, "isPrivate", void 0), _define_property(this, "folder", void 0);
28
29
  }
29
30
  }
31
+ _ts_decorate([
32
+ Column({
33
+ type: 'varchar',
34
+ length: 255,
35
+ nullable: false
36
+ }),
37
+ _ts_metadata("design:type", String)
38
+ ], FileManager.prototype, "name", void 0);
39
+ _ts_decorate([
40
+ Column({
41
+ type: 'varchar',
42
+ length: 255,
43
+ nullable: false
44
+ }),
45
+ _ts_metadata("design:type", String)
46
+ ], FileManager.prototype, "contentType", void 0);
47
+ _ts_decorate([
48
+ Column({
49
+ type: 'varchar',
50
+ length: 255,
51
+ nullable: false
52
+ }),
53
+ _ts_metadata("design:type", String)
54
+ ], FileManager.prototype, "size", void 0);
55
+ _ts_decorate([
56
+ Column({
57
+ type: 'text',
58
+ nullable: false
59
+ }),
60
+ _ts_metadata("design:type", String)
61
+ ], FileManager.prototype, "key", void 0);
62
+ _ts_decorate([
63
+ Column({
64
+ type: 'text',
65
+ nullable: true
66
+ }),
67
+ _ts_metadata("design:type", Object)
68
+ ], FileManager.prototype, "url", void 0);
69
+ _ts_decorate([
70
+ Column({
71
+ type: 'text',
72
+ nullable: false
73
+ }),
74
+ _ts_metadata("design:type", typeof FileLocationEnum === "undefined" ? Object : FileLocationEnum)
75
+ ], FileManager.prototype, "location", void 0);
76
+ _ts_decorate([
77
+ Column({
78
+ type: 'uuid',
79
+ nullable: true
80
+ }),
81
+ _ts_metadata("design:type", Object)
82
+ ], FileManager.prototype, "storageConfigId", void 0);
83
+ _ts_decorate([
84
+ Column({
85
+ type: 'bigint',
86
+ nullable: true
87
+ }),
88
+ _ts_metadata("design:type", Object)
89
+ ], FileManager.prototype, "expiresAt", void 0);
90
+ _ts_decorate([
91
+ Column({
92
+ type: 'boolean',
93
+ nullable: false,
94
+ default: false
95
+ }),
96
+ _ts_metadata("design:type", Boolean)
97
+ ], FileManager.prototype, "isPrivate", void 0);
30
98
  _ts_decorate([
31
99
  ManyToOne('Folder', (folder)=>folder.fileManager, {
32
100
  nullable: true,
@@ -21,11 +21,10 @@ function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
23
  import { Column, Entity, OneToMany } from 'typeorm';
24
- import { FolderBase } from './folder-base.entity';
25
- export class FolderWithCompany extends FolderBase {
24
+ import { Folder } from './folder.entity';
25
+ export class FolderWithCompany extends Folder {
26
26
  constructor(...args){
27
- super(...args), // Company ID - used when company feature is enabled
28
- _define_property(this, "companyId", void 0), _define_property(this, "fileManager", void 0);
27
+ super(...args), _define_property(this, "companyId", void 0);
29
28
  }
30
29
  }
31
30
  _ts_decorate([
@@ -20,13 +20,29 @@ function _ts_decorate(decorators, target, key, desc) {
20
20
  function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
- import { Entity, OneToMany } from 'typeorm';
24
- import { FolderBase } from './folder-base.entity';
25
- export class Folder extends FolderBase {
23
+ import { Identity } from '@flusys/nestjs-shared/entities';
24
+ import { Column, Entity, OneToMany } from 'typeorm';
25
+ export class Folder extends Identity {
26
26
  constructor(...args){
27
- super(...args), _define_property(this, "fileManager", void 0);
27
+ super(...args), _define_property(this, "name", void 0), _define_property(this, "slug", void 0), _define_property(this, "fileManager", void 0);
28
28
  }
29
29
  }
30
+ _ts_decorate([
31
+ Column({
32
+ type: 'varchar',
33
+ length: 255,
34
+ nullable: false
35
+ }),
36
+ _ts_metadata("design:type", String)
37
+ ], Folder.prototype, "name", void 0);
38
+ _ts_decorate([
39
+ Column({
40
+ type: 'varchar',
41
+ length: 255,
42
+ nullable: false
43
+ }),
44
+ _ts_metadata("design:type", String)
45
+ ], Folder.prototype, "slug", void 0);
30
46
  _ts_decorate([
31
47
  OneToMany('FileManager', (fileManager)=>fileManager.folder),
32
48
  _ts_metadata("design:type", Array)
@@ -1,7 +1,3 @@
1
- // Base entities
2
- export * from './file-manager-base.entity';
3
- export * from './folder-base.entity';
4
- export * from './storage-config-base.entity';
5
1
  // Entities without company feature
6
2
  export * from './file-manager.entity';
7
3
  export * from './folder.entity';
@@ -28,10 +24,10 @@ export const StorageCompanyEntities = [
28
24
  FolderWithCompany,
29
25
  StorageConfigWithCompany
30
26
  ];
31
- export const StorageAllEntities = [
32
- ...StorageCoreEntities,
33
- ...StorageCompanyEntities
34
- ];
35
27
  export function getStorageEntitiesByConfig(enableCompanyFeature) {
36
28
  return enableCompanyFeature ? StorageCompanyEntities : StorageCoreEntities;
37
29
  }
30
+ // Base type aliases for backwards compatibility with services
31
+ export { FileManager as FileManagerBase } from './file-manager.entity';
32
+ export { Folder as FolderBase } from './folder.entity';
33
+ export { StorageConfig as StorageConfigBase } from './storage-config.entity';
@@ -21,11 +21,10 @@ function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
23
  import { Column, Entity } from 'typeorm';
24
- import { StorageConfigBase } from './storage-config-base.entity';
25
- export class StorageConfigWithCompany extends StorageConfigBase {
24
+ import { StorageConfig } from './storage-config.entity';
25
+ export class StorageConfigWithCompany extends StorageConfig {
26
26
  constructor(...args){
27
- super(...args), // Company ID - used when company feature is enabled
28
- _define_property(this, "companyId", void 0);
27
+ super(...args), _define_property(this, "companyId", void 0);
29
28
  }
30
29
  }
31
30
  _ts_decorate([
@@ -1,15 +1,86 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
1
14
  function _ts_decorate(decorators, target, key, desc) {
2
15
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
16
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
17
  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;
5
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
19
  }
7
- import { Entity } from 'typeorm';
8
- import { StorageConfigBase } from './storage-config-base.entity';
9
- export class StorageConfig extends StorageConfigBase {
20
+ function _ts_metadata(k, v) {
21
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
+ }
23
+ import { Identity } from '@flusys/nestjs-shared/entities';
24
+ import { FileLocationEnum } from '../enums';
25
+ import { Column, Entity, Index } from 'typeorm';
26
+ export class StorageConfig extends Identity {
27
+ constructor(...args){
28
+ super(...args), _define_property(this, "name", void 0), _define_property(this, "storage", void 0), _define_property(this, "config", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isDefault", void 0);
29
+ }
10
30
  }
31
+ _ts_decorate([
32
+ Column({
33
+ type: 'varchar',
34
+ length: 255,
35
+ nullable: false
36
+ }),
37
+ _ts_metadata("design:type", String)
38
+ ], StorageConfig.prototype, "name", void 0);
39
+ _ts_decorate([
40
+ Column({
41
+ type: 'enum',
42
+ enum: FileLocationEnum,
43
+ nullable: false
44
+ }),
45
+ _ts_metadata("design:type", typeof FileLocationEnum === "undefined" ? Object : FileLocationEnum)
46
+ ], StorageConfig.prototype, "storage", void 0);
47
+ _ts_decorate([
48
+ Column({
49
+ type: 'json',
50
+ nullable: false
51
+ }),
52
+ _ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
53
+ ], StorageConfig.prototype, "config", void 0);
54
+ _ts_decorate([
55
+ Column({
56
+ type: 'boolean',
57
+ default: true,
58
+ name: 'is_active'
59
+ }),
60
+ _ts_metadata("design:type", Boolean)
61
+ ], StorageConfig.prototype, "isActive", void 0);
62
+ _ts_decorate([
63
+ Column({
64
+ type: 'boolean',
65
+ default: false,
66
+ name: 'is_default'
67
+ }),
68
+ _ts_metadata("design:type", Boolean)
69
+ ], StorageConfig.prototype, "isDefault", void 0);
11
70
  StorageConfig = _ts_decorate([
12
71
  Entity({
13
72
  name: 'storage_config'
14
- })
73
+ }),
74
+ Index([
75
+ 'name'
76
+ ]),
77
+ Index([
78
+ 'storage'
79
+ ]),
80
+ Index([
81
+ 'isActive'
82
+ ]),
83
+ Index([
84
+ 'isDefault'
85
+ ])
15
86
  ], StorageConfig);