You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: services/subscription-service/README.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,47 @@ This microservice uses [loopback4-authentication](https://www.npmjs.com/package/
123
123
124
124
- Bind any of the custom [providers](#providers) you need.
125
125
126
+
### Usage Via Sourceloop CLI
127
+
You need to have [@sourceloop/cli](https://www.npmjs.com/package/@sourceloop/cli) installed on your system
128
+
```sh
129
+
$ [npm install | yarn add] @sourceloop/cli
130
+
```
131
+
follow the below steps:
132
+
- Run ***sl scaffold myapp*** to scaffold a Lerna monorepo, if you already don't have any monorepo.
133
+
- select all the required configuration by answering to prompted questions.
134
+
- Navigate into your project using cd myapp.
135
+
- Run ***sl microservice subscription-service***.
136
+
- Through the prompts, you can set up migrations, configure the datasource, bind components in application.ts, and complete other necessary setups.
137
+
- This microservice uses loopback4-authentication and @sourceloop/core and that uses asymmetric token encryption and decryption by default for that setup please refer their documentation but if you wish to override
comment the following since we are using our custom sequence
161
+
162
+
```typescript
163
+
// Set up the custom sequence
164
+
//this.sequence(MySequence);
165
+
```
166
+
126
167
## Integrating Billing Functionality into Subscription Service using LoopBack 4
127
168
128
169
We are leveraging the [loopback4-billing](https://github.com/sourcefuse/loopback4-billing) package to integrate billing capabilities into our Subscription Service.
@@ -455,6 +496,19 @@ export class FeatureToggleDbDataSource
455
496
456
497
The migrations required for this service can be copied from the service. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
457
498
499
+
- copy the selected migration according to your need. we have provided the postgresql migration files.
500
+
- copy them in your application with directory migration/sql at root.
501
+
- add the below scripts to your applciation package.json
502
+
503
+
```
504
+
"migrate:up": "db-migrate up --config database.json -m ./migrations",
505
+
"migrate:down": "db-migrate down --config database.json -m ./migrations",
506
+
"migrate:create": "db-migrate create --sql-file"
507
+
```
508
+
- do npm i db-migrate db-migrate-pg,
509
+
510
+
if you are generating the application using [@sourceloop/cli](https://www.npmjs.com/package/@sourceloop/cli), then you can skip these configuration and and generate all the migration related configuration by providing the answering the prmpted question on running - sl microservice
@@ -98,7 +98,47 @@ comment the following since we are using our custom sequence
98
98
99
99
- Set up a [Loopback4 Datasource](https://loopback.io/doc/en/lb4/DataSource.html) with `dataSourceName` property set to
100
100
`TenantManagementDB`. You can see an example datasource [here](#setting-up-a-datasource).
101
+
-
102
+
103
+
### Usage Via Sourceloop CLI
104
+
You need to have [@sourceloop/cli](https://www.npmjs.com/package/@sourceloop/cli) installed on your system
105
+
```sh
106
+
$ [npm install | yarn add] @sourceloop/cli
107
+
```
108
+
follow the below steps:
109
+
- Run ***sl scaffold myapp*** to scaffold a Lerna monorepo.
110
+
- select all the required configuration by answering to prompted questions.
111
+
- Navigate into your project using cd myapp.
112
+
- Run ***sl microservice tenant-mgmt-service***.
113
+
- Through the prompts, you can set up migrations, configure the datasource, bind components in application.ts, and complete other necessary setups.
114
+
- This microservice uses loopback4-authentication and @sourceloop/core and that uses asymmetric token encryption and decryption by default for that setup please refer their documentation but if you wish to override
- The onboarding process starts through a concept of a `Lead`. A `Lead` is a prospective client who may or may not end being a tenant in our system.
@@ -162,6 +202,17 @@ export class TenantEventPublisher {
162
202
}
163
203
```
164
204
205
+
### Configure EventBridge for publishing events
206
+
bind the below binding to the application.ts
207
+
208
+
```typescript
209
+
this.bind(EventBridgeStreamBindings.Config).to({
210
+
source: 'tenant-management',
211
+
});
212
+
this.component(EventBridgeConnector);
213
+
```
214
+
215
+
165
216
## IDP - Identity Provider
166
217
167
218
The IDP (Identity Provider) Controller provides an endpoint to manage identity provider configurations for tenants. It supports multiple identity providers, such as Keycloak and Auth0, and ensures secure handling of identity provider setup requests through rate-limiting, authorization, and input validation.
@@ -673,6 +724,20 @@ export class RedisDataSource
673
724
674
725
The migrations required for this service can be copied from the service. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
675
726
727
+
- copy the selected migration according to your need. we have provided the postgresql migration files.
728
+
- copy them in your application with directory migration/sql at root.
729
+
- add the below scripts to your applciation package.json
730
+
731
+
```
732
+
"migrate:up": "db-migrate up --config database.json -m ./migrations",
733
+
"migrate:down": "db-migrate down --config database.json -m ./migrations",
734
+
"migrate:create": "db-migrate create --sql-file"
735
+
```
736
+
- do npm i db-migrate db-migrate-pg,
737
+
738
+
if you are generating the application using [@sourceloop/cli](https://www.npmjs.com/package/@sourceloop/cli), then you can skip these configuration and and generate all the migration related configuration by providing the answering the prmpted question on running - sl microservice
0 commit comments