Skip to content

Commit 84c012f

Browse files
committed
chore: Add @the-software-compagny/nestjs_module_factorydrive and @the-software-compagny/nestjs_module_factorydrive-s3 dependencies
1 parent e7a3ec2 commit 84c012f

File tree

5 files changed

+1204
-5
lines changed

5 files changed

+1204
-5
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
"@nestjs/passport": "^10.0.3",
6060
"@nestjs/platform-express": "^10.3.9",
6161
"@nestjs/swagger": "^7.3.1",
62+
"@the-software-compagny/nestjs_module_factorydrive": "^1.1.5",
63+
"@the-software-compagny/nestjs_module_factorydrive-s3": "^1.0.1",
6264
"@the-software-compagny/nestjs_module_restools": "^0.0.5",
6365
"ajv": "^8.16.0",
6466
"ajv-errors": "^3.0.0",
@@ -109,6 +111,7 @@
109111
"@types/fast-password-entropy": "^1.1.3",
110112
"@types/inquirer": "^9.0.7",
111113
"@types/jest": "^29.5.12",
114+
"@types/multer": "^1.4.11",
112115
"@types/node": "^20.14.8",
113116
"@types/nodemailer": "^6.4.15",
114117
"@types/passport": "^1.0.16",

src/app.module.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { DtoValidationPipe } from './_common/pipes/dto-validation.pipe';
1818
import { SettingstModule } from "~/settings/settings.module";
1919
import { MailerModule } from "@nestjs-modules/mailer";
2020
import { HandlebarsAdapter } from "@nestjs-modules/mailer/dist/adapters/handlebars.adapter";
21+
import { FactorydriveModule } from '@the-software-compagny/nestjs_module_factorydrive';
2122

2223
@Module({
2324
imports: [
@@ -76,6 +77,13 @@ import { HandlebarsAdapter } from "@nestjs-modules/mailer/dist/adapters/handleba
7677
},
7778
}),
7879
}),
80+
FactorydriveModule.forRootAsync({
81+
imports: [ConfigModule],
82+
inject: [ConfigService],
83+
useFactory: async (config: ConfigService) => ({
84+
...config.get('factorydrive.options'),
85+
}),
86+
}),
7987
RequestContextModule,
8088
CoreModule.register(),
8189
ManagementModule.register(),

src/config.ts

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { HelmetOptions } from 'helmet';
44
import { SwaggerCustomOptions } from '@nestjs/swagger';
55
import { IAuthModuleOptions } from '@nestjs/passport';
66
import { JwtModuleOptions } from '@nestjs/jwt';
7+
import { StorageManagerConfig } from '@the-software-compagny/nestjs_module_factorydrive';
8+
import { AmazonWebServicesS3StorageConfig } from '@the-software-compagny/nestjs_module_factorydrive-s3';
79

810
export interface MongoosePlugin {
911
package: string;
@@ -28,6 +30,18 @@ export interface ConfigInstance {
2830
uri: string;
2931
options: RedisOptions;
3032
};
33+
factorydrive: {
34+
options:
35+
| StorageManagerConfig
36+
| {
37+
disks: {
38+
[key: string]: {
39+
driver: 's3'
40+
config: AmazonWebServicesS3StorageConfig
41+
}
42+
}
43+
}
44+
}
3145
passport: {
3246
options: IAuthModuleOptions;
3347
};
@@ -39,15 +53,15 @@ export interface ConfigInstance {
3953
port: number;
4054
sender: string;
4155
};
42-
sms:{
56+
sms: {
4357
host: string,
4458
systemId: string,
4559
password: string,
4660
sourceAddr: string,
4761
regionCode: string
4862
},
4963
frontPwd: {
50-
url:string;
64+
url: string;
5165
identityMailAttribute: string;
5266
identityMobileAttribute: string;
5367
};
@@ -93,6 +107,25 @@ export default (): ConfigInstance => ({
93107
},
94108
plugins: [],
95109
},
110+
factorydrive: {
111+
options: {
112+
default: 'local',
113+
disks: {
114+
local: {
115+
driver: 'local',
116+
config: {
117+
root: process.cwd() + '/storage',
118+
},
119+
},
120+
pictures: {
121+
driver: 'local',
122+
config: {
123+
root: process.cwd() + '/storage/pictures',
124+
},
125+
},
126+
},
127+
},
128+
},
96129
passport: {
97130
options: {
98131
defaultStrategy: 'jwt',
@@ -118,17 +151,17 @@ export default (): ConfigInstance => ({
118151
},
119152
},
120153
},
121-
mailer:{
154+
mailer: {
122155
host: process.env['SESAME_SMTP_SERVER'],
123156
port: parseInt(process.env['SESAME_SMTP_PORT']) || 25,
124157
sender: process.env['SESAME_MDP_SENDER'] || 'noreply@mydomain.com'
125158
},
126-
frontPwd:{
159+
frontPwd: {
127160
url: process.env['SESAME_FRONT_MDP'],
128161
identityMailAttribute: process.env['SESAME_RESET_PWD_MAIL'] || '',
129162
identityMobileAttribute: process.env['SESAME_RESET_PWD_MOBILE'] || ''
130163
},
131-
sms:{
164+
sms: {
132165
host: process.env['SESAME_SMPP_SERVER'] || '',
133166
systemId: process.env['SESAME_SMPP_SYSTEMID'] || '',
134167
password: process.env['SESAME_SMPP_PASSWORD'] || '',

storage/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)