diff --git a/.github/workflows/automatic-release.yml b/.github/workflows/automatic-release.yml index 99947eb..a95e2c1 100644 --- a/.github/workflows/automatic-release.yml +++ b/.github/workflows/automatic-release.yml @@ -2,46 +2,48 @@ name: Automatic Release on: push: branches: - - "release-candidate" - + - 'release-candidate' + jobs: pre-release: - name: "Pre Release" - runs-on: "ubuntu-latest" + name: 'Pre Release' + runs-on: 'ubuntu-latest' steps: - - uses: actions/checkout@v2 - - run: mkdir -p /tmp/ - - run: curl --location --request GET 'https://sonarcloud.io/api/measures/search_history?component=Lend-it_Request&metrics=new_technical_debt,blocker_violations,bugs,classes,code_smells,cognitive_complexity,comment_lines,comment_lines_density,complexity_in_classes,complexity_in_functions,branch_coverage,new_branch_coverage,new_conditions_to_cover,confirmed_issues,coverage,new_coverage,complexity,development_cost,new_development_cost,duplicated_blocks,new_duplicated_blocks,duplicated_files,duplicated_lines,duplicated_lines_density,new_duplicated_lines_density,new_duplicated_lines,duplications_data,effort_to_reach_maintainability_rating_a,false_positive_issues,file_complexity_distribution,files,function_complexity_distribution,functions,generated_lines,generated_ncloc,info_violations,violations,line_coverage,new_line_coverage,ncloc,ncloc_language_distribution,lines_to_cover,new_lines_to_cover,sqale_rating,new_maintainability_rating,major_violations,minor_violations,new_blocker_violations,new_bugs,new_code_smells,new_critical_violations,new_info_violations,new_violations,new_lines,new_major_violations,new_minor_violations,new_security_hotspots,new_vulnerabilities,open_issues,quality_profiles,projects,public_api,public_documented_api_density,quality_gate_details,alert_status,reliability_rating,new_reliability_rating,reliability_remediation_effort,new_reliability_remediation_effort,reopened_issues,security_hotspots,security_hotspots_reviewed,new_security_hotspots_reviewed,security_rating,new_security_rating,security_remediation_effort,new_security_remediation_effort,security_review_rating,new_security_review_rating,security_hotspots_reviewed_status,new_security_hotspots_reviewed_status,security_hotspots_to_review_status,new_security_hotspots_to_review_status,skipped_tests,statements,sqale_index,sqale_debt_ratio,new_sqale_debt_ratio' > /tmp/sonar_cloud_request.json - - uses: actions/upload-artifact@v2 - with: - name: sonar_cloud_request.json - path: /tmp/sonar_cloud_request.json - - run: curl --location --request GET 'https://sonarcloud.io/api/measures/search_history?component=Lend-it_Rating&metrics=new_technical_debt,blocker_violations,bugs,classes,code_smells,cognitive_complexity,comment_lines,comment_lines_density,complexity_in_classes,complexity_in_functions,branch_coverage,new_branch_coverage,new_conditions_to_cover,confirmed_issues,coverage,new_coverage,complexity,development_cost,new_development_cost,duplicated_blocks,new_duplicated_blocks,duplicated_files,duplicated_lines,duplicated_lines_density,new_duplicated_lines_density,new_duplicated_lines,duplications_data,effort_to_reach_maintainability_rating_a,false_positive_issues,file_complexity_distribution,files,function_complexity_distribution,functions,generated_lines,generated_ncloc,info_violations,violations,line_coverage,new_line_coverage,ncloc,ncloc_language_distribution,lines_to_cover,new_lines_to_cover,sqale_rating,new_maintainability_rating,major_violations,minor_violations,new_blocker_violations,new_bugs,new_code_smells,new_critical_violations,new_info_violations,new_violations,new_lines,new_major_violations,new_minor_violations,new_security_hotspots,new_vulnerabilities,open_issues,quality_profiles,projects,public_api,public_documented_api_density,quality_gate_details,alert_status,reliability_rating,new_reliability_rating,reliability_remediation_effort,new_reliability_remediation_effort,reopened_issues,security_hotspots,security_hotspots_reviewed,new_security_hotspots_reviewed,security_rating,new_security_rating,security_remediation_effort,new_security_remediation_effort,security_review_rating,new_security_review_rating,security_hotspots_reviewed_status,new_security_hotspots_reviewed_status,security_hotspots_to_review_status,new_security_hotspots_to_review_status,skipped_tests,statements,sqale_index,sqale_debt_ratio,new_sqale_debt_ratio' > /tmp/sonar_cloud_rating.json - - uses: actions/upload-artifact@v2 - with: - name: sonar_cloud_rating.json - path: /tmp/sonar_cloud_rating.json - - run: curl --location --request GET 'https://sonarcloud.io/api/measures/search_history?component=Lend-it_User&metrics=new_technical_debt,blocker_violations,bugs,classes,code_smells,cognitive_complexity,comment_lines,comment_lines_density,complexity_in_classes,complexity_in_functions,branch_coverage,new_branch_coverage,new_conditions_to_cover,confirmed_issues,coverage,new_coverage,complexity,development_cost,new_development_cost,duplicated_blocks,new_duplicated_blocks,duplicated_files,duplicated_lines,duplicated_lines_density,new_duplicated_lines_density,new_duplicated_lines,duplications_data,effort_to_reach_maintainability_rating_a,false_positive_issues,file_complexity_distribution,files,function_complexity_distribution,functions,generated_lines,generated_ncloc,info_violations,violations,line_coverage,new_line_coverage,ncloc,ncloc_language_distribution,lines_to_cover,new_lines_to_cover,sqale_rating,new_maintainability_rating,major_violations,minor_violations,new_blocker_violations,new_bugs,new_code_smells,new_critical_violations,new_info_violations,new_violations,new_lines,new_major_violations,new_minor_violations,new_security_hotspots,new_vulnerabilities,open_issues,quality_profiles,projects,public_api,public_documented_api_density,quality_gate_details,alert_status,reliability_rating,new_reliability_rating,reliability_remediation_effort,new_reliability_remediation_effort,reopened_issues,security_hotspots,security_hotspots_reviewed,new_security_hotspots_reviewed,security_rating,new_security_rating,security_remediation_effort,new_security_remediation_effort,security_review_rating,new_security_review_rating,security_hotspots_reviewed_status,new_security_hotspots_reviewed_status,security_hotspots_to_review_status,new_security_hotspots_to_review_status,skipped_tests,statements,sqale_index,sqale_debt_ratio,new_sqale_debt_ratio' > /tmp/sonar_cloud_user.json - - uses: actions/upload-artifact@v2 - with: - name: sonar_cloud_user.json - path: /tmp/sonar_cloud_user.json + - uses: actions/checkout@v2 + - run: mkdir -p /tmp/ + - run: curl --location --request GET 'https://sonarcloud.io/api/measures/component_tree?component=Lend-it_Request&metricKeys=files,functions,complexity,coverage,ncloc,comment_lines_density,duplicated_lines_density,security_rating,tests,test_success_density,test_execution_time,reliability_rating&ps=500' > /tmp/sonar_cloud_request.json + - uses: actions/upload-artifact@v2 + with: + name: sonar_cloud_request.json + path: /tmp/sonar_cloud_request.json + + - run: curl --location --request GET 'https://sonarcloud.io/api/measures/component_tree?component=Lend-it_Rating&metricKeys=files,functions,complexity,coverage,ncloc,comment_lines_density,duplicated_lines_density,security_rating,tests,test_success_density,test_execution_time,reliability_rating&ps=500' > /tmp/sonar_cloud_rating.json + - uses: actions/upload-artifact@v2 + with: + name: sonar_cloud_rating.json + path: /tmp/sonar_cloud_rating.json + + - run: curl --location --request GET 'https://sonarcloud.io/api/measures/component_tree?component=Lend-it_User&metricKeys=files,functions,complexity,coverage,ncloc,comment_lines_density,duplicated_lines_density,security_rating,tests,test_success_density,test_execution_time,reliability_rating&ps=500' > /tmp/sonar_cloud_user.json + - uses: actions/upload-artifact@v2 + with: + name: sonar_cloud_user.json + path: /tmp/sonar_cloud_user.json - - run: curl --location --request GET 'https://sonarcloud.io/api/measures/search_history?component=Lend-it_Gateway&metrics=new_technical_debt,blocker_violations,bugs,classes,code_smells,cognitive_complexity,comment_lines,comment_lines_density,complexity_in_classes,complexity_in_functions,branch_coverage,new_branch_coverage,new_conditions_to_cover,confirmed_issues,coverage,new_coverage,complexity,development_cost,new_development_cost,duplicated_blocks,new_duplicated_blocks,duplicated_files,duplicated_lines,duplicated_lines_density,new_duplicated_lines_density,new_duplicated_lines,duplications_data,effort_to_reach_maintainability_rating_a,false_positive_issues,file_complexity_distribution,files,function_complexity_distribution,functions,generated_lines,generated_ncloc,info_violations,violations,line_coverage,new_line_coverage,ncloc,ncloc_language_distribution,lines_to_cover,new_lines_to_cover,sqale_rating,new_maintainability_rating,major_violations,minor_violations,new_blocker_violations,new_bugs,new_code_smells,new_critical_violations,new_info_violations,new_violations,new_lines,new_major_violations,new_minor_violations,new_security_hotspots,new_vulnerabilities,open_issues,quality_profiles,projects,public_api,public_documented_api_density,quality_gate_details,alert_status,reliability_rating,new_reliability_rating,reliability_remediation_effort,new_reliability_remediation_effort,reopened_issues,security_hotspots,security_hotspots_reviewed,new_security_hotspots_reviewed,security_rating,new_security_rating,security_remediation_effort,new_security_remediation_effort,security_review_rating,new_security_review_rating,security_hotspots_reviewed_status,new_security_hotspots_reviewed_status,security_hotspots_to_review_status,new_security_hotspots_to_review_status,skipped_tests,statements,sqale_index,sqale_debt_ratio,new_sqale_debt_ratio' > /tmp/sonar_cloud_gateway.json - - uses: actions/upload-artifact@v2 - with: - name: sonar_cloud_gateway.json - path: /tmp/sonar_cloud_gateway.json + - run: curl --location --request GET 'https://sonarcloud.io/api/measures/component_tree?component=Lend-it_Gateway&metricKeys=files,functions,complexity,coverage,ncloc,comment_lines_density,duplicated_lines_density,security_rating,tests,test_success_density,test_execution_time,reliability_rating&ps=500' > /tmp/sonar_cloud_gateway.json + - uses: actions/upload-artifact@v2 + with: + name: sonar_cloud_gateway.json + path: /tmp/sonar_cloud_gateway.json - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: false - title: "Automatic Release-Candidate release" - files: | + - uses: 'marvinpinto/action-automatic-releases@latest' + with: + repo_token: '${{ secrets.GITHUB_TOKEN }}' + automatic_release_tag: 'latest' + prerelease: false + title: 'Automatic Release-Candidate release' + files: | /tmp/sonar_cloud_request.json /tmp/sonar_cloud_rating.json /tmp/sonar_cloud_user.json - /tmp/sonar_cloud_gateway.json \ No newline at end of file + /tmp/sonar_cloud_gateway.json diff --git a/src/microservices/Request.js b/src/microservices/Request.js index a4cb4a3..5516203 100644 --- a/src/microservices/Request.js +++ b/src/microservices/Request.js @@ -26,14 +26,16 @@ async function getAllAvailableRequestExcludentUser(req, res) { } async function getFilteredByCategoryRequest(req, res) { - console.log(req.params.categoryId); - const response = await baseGet( - `${request}/requests/${req.params.categoryId}` + const { usermail } = req.query; + const response = await queryGet( + `${request}/requests/available/${req.params.categoryId}`, + { + usermail, + } ); - const requests = response.data.requests; + const { requests } = response.data; const mergedUserWithRequest = await mergeUserDataFromRequest(requests); - - res.json(mergedUserWithRequest); + res.status(200).json(mergedUserWithRequest); } async function createProductCategory(req, res) { diff --git a/src/routes/request.routes.js b/src/routes/request.routes.js index f32a95a..5b70421 100644 --- a/src/routes/request.routes.js +++ b/src/routes/request.routes.js @@ -6,10 +6,9 @@ const requestRouter = Router(); requestRouter.get('/request', Request.getRequest); requestRouter.get( - '/request/available/', - Request.getAllAvailableRequestExcludentUser + '/request/available/:categoryId', + Request.getFilteredByCategoryRequest ); -requestRouter.get('/request/:categoryId', Request.getFilteredByCategoryRequest); requestRouter.post('/request', Request.createRequest); requestRouter.put('/request/:id', Request.updateRequest); requestRouter.delete('/request/:id', Request.deleteRequest);