cc-core-cli 1.0.9 → 1.0.10
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/package.json +1 -1
- package/template/core/package.json +1 -1
- package/template/core/src/app.module.ts +3 -1
- package/template/core/src/main.ts +9 -36
- package/template/core/src/private.controller.ts +18 -0
- package/template/core/storage/public/system/menu/icons/company.svg +1 -0
- package/template/core/storage/public/system/menu/icons/deploy.svg +2 -0
- package/template/core/storage/public/system/menu/icons/entities.svg +55 -0
- package/template/core/storage/public/system/menu/icons/gateway.svg +1 -0
- package/template/core/storage/public/system/menu/icons/import-export.svg +41 -0
- package/template/core/storage/public/system/menu/icons/integration.svg +1 -0
- package/template/core/storage/public/system/menu/icons/master_data.svg +53 -0
- package/template/core/storage/public/system/menu/icons/monitoring.svg +114 -0
- package/template/core/storage/public/system/menu/icons/provider.svg +1 -0
- package/template/core/storage/public/system/menu/icons/report.svg +69 -0
- package/template/core/storage/public/system/menu/icons/schedule.svg +1 -0
- package/template/core/storage/public/system/menu/icons/security.svg +1 -0
- package/template/core/storage/public/system/menu/icons/storage.svg +1 -0
- package/template/core/storage/public/system/menu/icons/template.svg +44 -0
- package/template/core/storage/public/system/menu/icons/theme-layout.svg +1 -0
- package/template/core/package-lock.json +0 -30406
- package/template/core/src/storage.module.ts +0 -103
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as _ from "lodash";
|
|
2
|
-
import * as dotenv from "dotenv";
|
|
3
|
-
|
|
4
|
-
import { Controller, Get, Module, Param } from "@nestjs/common";
|
|
5
|
-
import { MongooseModule } from "@nestjs/mongoose";
|
|
6
|
-
|
|
7
|
-
import { ClsModule } from "nestjs-cls";
|
|
8
|
-
import { AttachmentService, AuthModule, AttachmentModule, Public } from "@shopstack/cc-core-lib/core";
|
|
9
|
-
|
|
10
|
-
const mongoConfig = {};
|
|
11
|
-
if (+process.env.MONGODB_MIN_POOL_SIZE) {
|
|
12
|
-
mongoConfig["minPoolSize"] = +process.env.MONGODB_MIN_POOL_SIZE;
|
|
13
|
-
}
|
|
14
|
-
if (+process.env.MONGODB_MAX_POOL_SIZE) {
|
|
15
|
-
mongoConfig["maxPoolSize"] = +process.env.MONGODB_MAX_POOL_SIZE;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@Controller()
|
|
19
|
-
export class StoragePrivateController {
|
|
20
|
-
constructor(private readonly attachment: AttachmentService) {}
|
|
21
|
-
|
|
22
|
-
@Public()
|
|
23
|
-
@Get("/health_check")
|
|
24
|
-
healthCheck(): boolean {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// @Public()
|
|
29
|
-
// @Get("/health_check/init")
|
|
30
|
-
// init(): string {
|
|
31
|
-
// return this.appService.init();
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
|
-
@Get("/*")
|
|
35
|
-
getMedia(@Param() params: any): any {
|
|
36
|
-
const filename = params["*"]
|
|
37
|
-
.split("/")
|
|
38
|
-
.slice(-1)
|
|
39
|
-
.toString();
|
|
40
|
-
const path = params["*"].replace(`/${filename}`, "");
|
|
41
|
-
|
|
42
|
-
return this.attachment.downloadStream(path, filename);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@Module({
|
|
47
|
-
imports: [
|
|
48
|
-
MongooseModule.forRoot(process.env.MONGODB_URI, mongoConfig),
|
|
49
|
-
ClsModule.forRoot({
|
|
50
|
-
middleware: {
|
|
51
|
-
// automatically mount the
|
|
52
|
-
// ClsMiddleware for all routes
|
|
53
|
-
mount: true,
|
|
54
|
-
// and use the setup method to
|
|
55
|
-
// provide default store values.
|
|
56
|
-
setup: (cls, req) => {
|
|
57
|
-
cls.set("request", {
|
|
58
|
-
api_key: _.get(req, "api_key", {}),
|
|
59
|
-
profile: _.get(req, "profile", {}),
|
|
60
|
-
permissions: _.get(req, "permissions", []),
|
|
61
|
-
headers: _.get(req, "headers", {}),
|
|
62
|
-
ip: _.get(req, "ip"),
|
|
63
|
-
hostname: _.get(req, "hostname"),
|
|
64
|
-
body: _.get(req, "body", {}),
|
|
65
|
-
action_profile: _.get(req, "action_profile", {})
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
interceptor: {
|
|
70
|
-
mount: true,
|
|
71
|
-
setup: (cls, ctx) => {
|
|
72
|
-
const req = ctx.switchToHttp().getRequest();
|
|
73
|
-
cls.set("request", {
|
|
74
|
-
api_key: _.get(req, "api_key", {}),
|
|
75
|
-
profile: _.get(req, "profile", {}),
|
|
76
|
-
permissions: _.get(req, "permissions", []),
|
|
77
|
-
roles: _.get(req, "roles", []),
|
|
78
|
-
headers: _.get(req, "headers", {}),
|
|
79
|
-
// ip: req.connection.remoteAddress,
|
|
80
|
-
ip:
|
|
81
|
-
_.get(req, "socket.remoteAddress") ||
|
|
82
|
-
_.get(req, "connection.remoteAddress"),
|
|
83
|
-
hostname: req.hostname,
|
|
84
|
-
body: _.get(req, "body", {}),
|
|
85
|
-
action_profile: _.get(req, "action_profile", {})
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}),
|
|
90
|
-
AuthModule,
|
|
91
|
-
AttachmentModule
|
|
92
|
-
],
|
|
93
|
-
controllers: [StoragePrivateController],
|
|
94
|
-
providers: []
|
|
95
|
-
})
|
|
96
|
-
export class StoragePrivateModule {}
|
|
97
|
-
|
|
98
|
-
@Module({
|
|
99
|
-
imports: [],
|
|
100
|
-
controllers: [],
|
|
101
|
-
providers: []
|
|
102
|
-
})
|
|
103
|
-
export class StoragePublicModule {}
|