User management service helps TDEI system to manage the user permissions and TDEI entities like project group, stations, service.
The project is built on NodeJS framework. All the regular nuances for a NodeJS project are valid for this.
| Software | Version |
|---|---|
| NodeJS | 16.17.0 |
| Typescript | 4.8.2 |
Step 1: Application configuration is read from .env file. Below are the list of environemnt variables service is dependent on. An example of environment file is available here and description of environment variable is presented in below table
| Name | Description |
|---|---|
| PROVIDER | Provider for cloud service or local |
| QUEUECONNECTION | Queue connection string |
| STORAGECONNECTION | Storage connection string |
| PORT | Port on which application will run |
| DATABASE_USER | Keycloak secret from portal |
| DATABASE_HOST | Queue connection string |
| DATABASE_PASSWORD | Storage connection string |
| DATABASE_DB | Port on which application will run |
| DATABASE_PORT | Upload topic subscription name |
| AUTH_HOST | Base URL for authentication service |
Step 2: Spin up Postgres server and PgAdmin dashboard for visualization. Docker need to be install on the system first before proceeding.
docker compose up from root directory
Step 3: Create the database tdei in the Postgresql
Step 4: Run the script init.sql under script folder. That will create table schemas in the database [One time]
Step 5: Run the script master-data.sql under script folder. This will insert the master roles, permissions, test users in the database
Follow the steps to install the node packages required for both building and running the application
-
Install the dependencies. Run the following command in terminal on the same directory as
package.jsonnpm install
-
To start the server, use the command
npm run start -
The http server by default starts with 8080 port or whatever is declared in
PORT -
By default
health/pingcall onlocalhost:8080gives a sample response
Follow the steps to install the node packages required for testing the application
- Ensure we have installed the dependencies. Run the following command in terminal on the same directory level as
package.jsonnpm install
- To start testing suits, use the command
npm test, this command will execute all the unit test suites defined for application.
Note: Unit test doesnt require any of the env variables. Running the above command will execute the suites.
To run integration test you need a .env file which will be available on request.
Steps to run:
Execute the following commands.
npm run i
npm run test:integration
For running integration test, following env variables are required.
| Name | Description |
|---|---|
| QUEUECONNECTION | Queue connection string |
| STORAGECONNECTION | Storage connection string |
| AUTH_HOST | Host of the authentication service |
| VALIDATION_SUBSCRIPTION | Upload topic subscription name |
| VALIDATION_TOPIC | Validation topic name |
| DATASVC_TOPIC | Data service publishing topic |
Detailed use case description can be found here
- The maximum size for the payload of a POST request is restricted to 100kb.
