@almatar/branding 0.1.1 → 0.1.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.
|
File without changes
|
|
@@ -29,6 +29,7 @@ var TenantMongooseModule = /** @class */ (function (_super) {
|
|
|
29
29
|
}
|
|
30
30
|
TenantMongooseModule.forFeature = function (models, connectionName) {
|
|
31
31
|
if (models === void 0) { models = []; }
|
|
32
|
+
connectionName = (connectionName) ? connectionName + "Connection" : 'MongooseConnectionName';
|
|
32
33
|
var modelProviders = mongoose_providers_1.createMongooseProviders(connectionName, models);
|
|
33
34
|
return {
|
|
34
35
|
module: mongoose_1.MongooseModule,
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var mongoose_utils_1 = require("../../../../node_modules/@nestjs/mongoose/dist/common/mongoose.utils");
|
|
4
3
|
var MongooseModel_1 = require("../MongooseModel");
|
|
5
4
|
function createMongooseProviders(connectionName, models) {
|
|
6
5
|
if (models === void 0) { models = []; }
|
|
7
6
|
var providers = (models || []).map(function (model) { return ({
|
|
8
|
-
provide:
|
|
7
|
+
provide: model.name + "Model",
|
|
9
8
|
useFactory: function (connection) {
|
|
10
9
|
var mongooseModel = new MongooseModel_1.MongooseModel(connection);
|
|
11
10
|
return mongooseModel.createModel(model.name, model.schema, model.collection, {});
|
|
12
11
|
},
|
|
13
|
-
inject: [
|
|
12
|
+
inject: [connectionName + "Connection"],
|
|
14
13
|
}); });
|
|
15
14
|
return providers;
|
|
16
15
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4,6 +4,17 @@ this package make microservice able to handle different brands
|
|
|
4
4
|
|
|
5
5
|
## How It Works
|
|
6
6
|
|
|
7
|
+
## Setup Branding Package
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
import { AlmatarBranding } from '@almatar/branding';
|
|
11
|
+
|
|
12
|
+
AlmatarBranding.setup({
|
|
13
|
+
employeeAuthService: config.EMPLOYEE_AUTH_SERVICE
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
|
|
7
18
|
## Nest.js
|
|
8
19
|
|
|
9
20
|
### save brand on any request
|
|
@@ -133,14 +144,3 @@ TenantRequest.request(reqOptions, (error, response, body) => {
|
|
|
133
144
|
console.log(body);
|
|
134
145
|
});
|
|
135
146
|
```
|
|
136
|
-
|
|
137
|
-
### Setup Branding Package
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
import { AlmatarBranding } from '@almatar/branding';
|
|
141
|
-
|
|
142
|
-
AlmatarBranding.setup({
|
|
143
|
-
employeeAuthService: config.EMPLOYEE_AUTH_SERVICE
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
```
|