Skip to content

Commit

Permalink
Merge pull request #37 from catenax-ng/main
Browse files Browse the repository at this point in the history
fix: Update Arq42 and DockerFile Scripts
  • Loading branch information
almadigabor authored Nov 7, 2023
2 parents d6fa4ee + 5a5b8ca commit e83b915
Show file tree
Hide file tree
Showing 39 changed files with 127 additions and 74 deletions.
6 changes: 1 addition & 5 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.1] - [Unreleased]

### Changed
- Updated arc42 documentation to align with the updated Country Risk application.
- Switched the shell interpreter from `bash` to `sh` in our scripts to enhance portability and reduce dependencies.
- Upgrade node version on Dockerfile

## [1.2.0] - 2023-10-11

### Added
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#*******************************************************************************

# Base image
FROM node:18-alpine AS compile-image
FROM node:20-alpine AS compile-image

# Set work directory
WORKDIR /app
Expand Down Expand Up @@ -67,9 +67,8 @@ COPY ./scripts/inject-dynamic-env.sh /docker-entrypoint.d/00-inject-dynamic-env.

RUN chmod +x /docker-entrypoint.d/00-inject-dynamic-env.sh

# Install bash and update vulnerable packages
RUN apk update && \
apk add --no-cache bash
# Update vulnerable packages
RUN apk update

# Change ownership and switch back to nginx user
RUN chown -R 101:101 /usr/share/nginx/html/
Expand Down
117 changes: 83 additions & 34 deletions docs/Arc42-Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ contributors. See <https://arc42.org>.

# Introduction and Goals

### Inital Situation from Business View
### Initial Situation from Business View

Geographical risks become more relevant in VUCA times and User from Business need an excellent solution to fulfill their requirements. VUCA meens volatile, uncertain, complex, and ambigous. In VUCA times, situations can change quickly (e.g. Ukraine war).
Geographical risks become more relevant in VUCA times and User from Business need an excellent solution to fulfill their requirements. VUCA means volatile, uncertain, complex, and ambiguous. In VUCA times, situations can change quickly (e.g. Ukraine war).

The Business challenge is to have awareness towards their business partners just in time. Be it in ongoing business or in the initiation of business. From business side the user needs to know who they are dealing with. This is especially true for business partners in a different country.

Expand Down Expand Up @@ -54,7 +54,7 @@ The benefit is to get to know your business partner or potential business partne

Role/Name | Contact | Expectations
----------------|-----------------------------------------------------------------------------------------------------------------------------------| -----------
Member Company | A company that participates in the Catena-X ecosystem (use-cases and data sharing). | Participate in the overal value proposition/stream provided by Catena-X.
Member Company | A company that participates in the Catena-X ecosystem (use-cases and data sharing). | Participate in the overall value proposition/stream provided by Catena-X.
Company Admin | A person that manages a single member companies integration into the dataspace on behalf of his employer. | Manage and monitor the proper integration and function of a member company within the Catena-X ecosystem.
Company User | A person that acts within the provided functionality of Catena-X on behalf of his employer (that is a member company) | Execute various permitted tasks on behalf of a member company the user is assigned to.

Expand All @@ -65,7 +65,7 @@ Company User | A person that acts within the provided functionality of Catena
- Run anywhere: can be deployed as a docker image, e. g. on Kubernetes (platform-independent, cloud, on prem or local).
- Modular design: core-components are loosely coupled.
- Freedom of choice for technology components stops where UX is negatively impacted.
(currently under revision by the overall catena architecture roundtable)
(currently under revision by the overall catena architecture round table)
- Roles & Rights Matrix: Roles & Rights Concept

## Roles Rights Management
Expand All @@ -77,12 +77,21 @@ There shall be 3 roles specific to the country risk application in the portal:
- Company Admin User
- Company Standard User


![RolesRightsManagement](../docs/Images/RolesRights.jpg)

There can be two more roles for now regarding what type of User this is, and they are:
- Customer
- Supplier

Each User can have none , one or both.
It will determine what columns we will see on the Table.

![table roles](../docs/Images/Table.png)

# System Scope and Context

![System Scope](../docs/Images/image2023-1-15_19-3-44.png)
![System Scope](../docs/Images/StandardisedDataExchange.png)


#### Example Data Sources
Expand Down Expand Up @@ -197,7 +206,7 @@ UI/UX | HTML, JavaScript, CSS

# Building Block View

## Whitebox Overall System
## White-box Overall System

This components Diagram represents the possible actions to be done by the user when opening the dashboard.

Expand Down Expand Up @@ -268,27 +277,49 @@ For this component, it is necessary to call three different APIs. The APIs used

# Interfaces

Please Check Swagger Doku
Please Check Swagger Documentation
https://vas-country-risk-backend.dev.demo.catena-x.net/swagger-ui/index.html#/


### Endpoint explanation:

## Dashboard Controller

![apiUpload](../docs/Images/reportUpdate.png)

This endpoint is used to update the report. An example in the dashboard is when a user updates a report such as changing the selected rating ranges to change the rating colour ranges, the user can press the save reports button and the new settings will be updated.

![updateReport](../docs/Images/updateReport.png)

![saveChangesReport](../docs/Images/saveChangesReport.png)


![apiUpload](../docs/Images/image2022-10-10_13-32-5.png)

In this endpoint, it is automatically inserted the information from the user that is accessing the tool, and it needs a manually inserted name and also an CSV file that can be retrieved in the download template in the tool. After this it is created a new registry with the information inside of the inserted CSV file onto the database. As parameters it requires the rating name, year, and type (Global, Company or Custom).
This endpoint automatically inserts the information from the current user. The uploaded file needs to be in the format of the template which may be downloaded, with the file name being manually set. After upload, the data in the file is available to be utilised by the user in the application. Required parameters are rating name, rating year, and type (Global, Company or Custom).

Example:

![csvselector](../docs/Images/SaveRating.png)

![csvfile](../docs/Images/image2022-10-10_15-43-52.png)

![shareReport](../docs/Images/shareReport.png)

This endpoint is used to share the ratings report.
When a user has already saved their report and would like to share it, the user can share the report with other users from their company who have the required permissions to the Country Risk Dashboard.

![shareReportIcon](../docs/Images/shareReportIcon.png)

![shareReportIconOption](../docs/Images/shareReportIconOption.png)

![saveRanges](../docs/Images/image2022-10-10_13-31-47.png)

In this endpoint, it is automatically inserted the information from the user that is accessing the tool, and it is manually inputted the three ranges currently selected by the user in the ranges component. These values are all saved using an object type. Example:

![ranges](../docs/Images/Ranges.png)


![saveReports](../docs/Images/image2022-12-5_12-40-53.png)

This endpoint is used to save an reports. It is used in the report component to save multiple selected data (Selected Ratings, Country, Range Values) and be able to use it in a later time. This endpoint receives as input field the Report name, the Type (Global, Company or Custom) of which the report should be saved for. Also it receives the current user information and an object that gathers all the selected data (Selected Ratings, Country, Range Values). Example:
Expand All @@ -311,7 +342,17 @@ This endpoint retrieves a score based on selected ratings, year and current user

This endpoint is used for retrieving an the current user ranges. The values retrieved are the three types of ranges (Minimum, middle and Maximum), each associated to a type of value. This values are used to populate the ranges component with the last saved ranges that the user inputted.

![RangesExample](../docs/Images/image2022-10-10_14-9-44.png)
![RangesExample](../docs/Images/ranges_example.png)


![template](../docs/Images/getUsersFromCompany.png)

This endpoint allows the retrieval of users from the user's company.
The company is automatically extracted from the authentication token, thus avoiding filters.
It is used when a report is to be shared for example.

![companyUsersResponse.png](../docs/Images/companyUsersResponse.png)


![template](../docs/Images/image2022-10-10_13-36-1.png)

Expand All @@ -335,6 +376,7 @@ This endpoint is used to retrieve reports. This endpoint receives as input field
This endpoint is used to retrieve reports. It is used in the report component to to populate the table. This endpoint only receives as input field the current user information.

![exampleuserinfo](../docs/Images/image2022-12-5_13-31-59.png)
This endpoint is used to retrieve all the Reports that a user can choose from.

![getcountryfilter](../docs/Images/image2022-10-10_13-43-23.png)

Expand All @@ -358,56 +400,63 @@ This endpoint retrieves all the countries that are associated to the Business pa

This endpoint returns information from the BPDM Gate to show the User specific Business Partners

![getscoresperbpn](../docs/Images/image2022-12-5_13-33-24.png)

In this endpoint the User can request a Mapping of Business Partners to a specific Rating. As parameters it is needed an Rating and BPNs array and also the company of he user.
![getyears](../docs/Images/image2022-10-10_13-44-13.png)

![examplequery](../docs/Images/image2022-12-5_14-14-19.png)
This endpoint retrieves all the years that are currently saved on the database. This years are used to populate the year selection dropdown in the tool.

In this picture, we can see how both the Ratings and BPNs are composed. The Ratings array can contain multiple objects that have the dataSourceName and the
![deleteReport](../docs/Images/image2022-12-30_11-37-34.png)

following year. Regarding the BPNs array, it can also contain multiple objects, and each of them have the BPN name and a country of which can be given a value
This endpoint is used to delete an report created by the user. It is used in the report table in the Front-End application. It needs the id related to the report selected and also the user information to proceed with the delete request.

or no value. If the BPN has no country value, the backend will map it according to the BPN.

![exampleresultmatching](../docs/Images/image2022-12-5_14-14-53.png)
![deleteRating](../docs/Images/image2022-12-30_11-50-52.png)

![getRatingsforCompany](../docs/Images/image2022-12-5_13-33-41.png)
This endpoint is used to delete an rating created by the user. It is used in the report table in the Front-End application. It needs the id related to the rating selected and also the user information to proceed with the delete request.

In this endpoint it is possible for the user to request Information about which Ratings are available to his Company. The information needed is solely the Company and the Year.
## Sharing Controller

![exampleratingsforcompany](../docs/Images/image2022-12-5_14-8-29.png)
![scoreforEachBpn](../docs/Images/scoreforEachBpn.png)

![getyears](../docs/Images/image2022-10-10_13-44-13.png)
In this endpoint the User can request a Mapping of Business Partners to a specific Rating. As parameters it is needed an Rating and BPNs array and also the company of he user.

This endpoint retrieves all the years that are currently saved on the database. This years are used to populate the year selection dropdown in the tool.
![examplequery](../docs/Images/image2022-12-5_14-14-19.png)

![deleteReport](../docs/Images/image2022-12-30_11-37-34.png)
In this picture, we can see how both the Ratings and BPNs are composed. The Ratings array can contain multiple objects that have the dataSourceName and the

This endpoint is used to delete an report created by the user. It is used in the report table in the Front-End application. It needs the id related to the report selected and also the user information to proceed with the delete request.
following year. Regarding the BPNs array, it can also contain multiple objects, and each of them have the BPN name and a country of which can be given a value

or no value. If the BPN has no country value, the backend will map it according to the BPN.

![exampleForEachBpn](../docs/Images/exampleForEachBpn.png)

![deleteRating](../docs/Images/image2022-12-30_11-50-52.png)

This endpoint is used to delete an rating created by the user. It is used in the report table in the Front-End application. It needs the id related to the rating selected and also the user information to proceed with the delete request.

![endpointAllRatingsForCompany](../docs/Images/endpointAllRatingsForCompany.png)

In this endpoint it is possible for the user to request Information about which Ratings are available to his Company. The information needed is solely the Company and the Year.

![exampleratingsforcompany](../docs/Images/image2022-12-5_14-8-29.png)

## How to configure the Gate Connection

### Setting up Company Cluster

The first step to connect the Dashboard to a company specific "Gate" is setting up a Company Group.

![addcompanygroup](../docs/Configuration-of-Gates/2023-02-24_12_45_25.png)

- company_name: Inser the Name of the requesting Company
- company_group_id: Set a numeric value counting up from the beginning 1 per company
![addcompanygroup](../docs/Configuration-of-Gates/configofgates03.png)

we create a company group for the Case that a sharing Company has multiple "Gates" to which can be connected.


### Setting up Company
To be able to connect to a company specific Gate first the Company has to be inserted into the t_company table and connected to a company group:

![addcompany](../docs/Configuration-of-Gates/2023-02-24_12_43_46.png)
![addcompany](../docs/Configuration-of-Gates/configofgates02.png)

- company_name: Insert the Name of the requesting Company
- company_group_id: Set a numeric value counting up from the beginning 1 per company


After the company has been added to the Table the next step is to set a "Gate" for this company.

Expand All @@ -416,7 +465,7 @@ After the company has been added to the Table the next step is to set a "Gate" f

To set the "Gate" Link the Administrator has to insert the following Information into the table t_company_group_gates

![addGate](../docs/Configuration-of-Gates/2023-02-24_12_41_14.png)
![addGate](../docs/Configuration-of-Gates/configofgates01.png)

- gate_name: can be given freely preferably connected to name of the company
- company_gate_value: Direct Link to "Gate" developed by the BPDM Team
Expand Down Expand Up @@ -674,7 +723,7 @@ If the report would been duplicated, an Http Bad Request status would be shown,

![updateReports](../docs/Images/image2023-1-11_9-49-15.jpg)

In this endpoint, it is received as a parameter the CompanyUser and an ReportDTO that will be used to be upated. It is used to update an ReportDTO related to the CompanyUser parameter received.
In this endpoint, it is received as a parameter the CompanyUser and an ReportDTO that will be used to be updated. It is used to update an ReportDTO related to the CompanyUser parameter received.

The method 1.1.1 getOrCreate will receive the parameter CompanyUser, and will do a verification if that user is already created. If not it will create that user.

Expand Down Expand Up @@ -711,7 +760,7 @@ The method 1.1.1 getGatesForCompanyUser, it firstly done the method getCompanyBy
After this, an List of CompanyGatesDTOS is returned in the main class (DashBoardResouce).


#### Endpoint: /dashboard/getAllRatingsForCompany
#### Endpoint: /sharing/getAllRatingsForCompany

![getAllRatingsforCompany](../docs/Images/image2023-1-11_9-58-31.jpg)

Expand All @@ -724,7 +773,7 @@ After that, the method 1.1.1.2 findByYearPublishedAndCompanyUserCompanyNameAndTy
After this, both lists are join onto one and returned in the main class as an List of DataSourceDTO.


#### Endpoint: /dashboard/getAllRatingsScoresForEachBpn
#### Endpoint: /sharing/getAllRatingsScoresForEachBpn

![getRatingsScore](../docs/Images/image2023-1-11_9-58-28.jpg)

Expand Down
Binary file added docs/Images/StandardisedDataExchange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/Table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/companyUsersResponse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/endpointAllRatingsForCompany.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/endpointAllRatingsForCompany.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/exampleForEachBpn.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/exampleForEachBpn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/getUsersFromCompany.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/getUsersFromCompany.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/ranges_example.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/ranges_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/reportUpdate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/saveChangesReport.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/saveChangesReport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/scoreforEachBpn.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/scoreforEachBpn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/shareReport.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/shareReport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/shareReportIcon.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/shareReportIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/shareReportIconOption.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/shareReportIconOption.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Images/updateReport.PNG
Binary file added docs/Images/updateReport.png
Binary file modified docs/User-Guide-Images/Table.png
Binary file added docs/User-Guide-Images/add_app.png
Binary file added docs/User-Guide-Images/login.png
Binary file added docs/User-Guide-Images/login_board.png
Binary file added docs/User-Guide-Images/main_page.png
Loading

0 comments on commit e83b915

Please sign in to comment.