Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fixed master
Browse files Browse the repository at this point in the history
  • Loading branch information
Manueluz committed Apr 25, 2024
1 parent 4905ab7 commit d0f4d87
Show file tree
Hide file tree
Showing 104 changed files with 21,513 additions and 1,602 deletions.
139 changes: 139 additions & 0 deletions .codescene/code-health-rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"usage" : "Persist this file inside your repositories as .codescene/code-health-rules.json Keep the rules you want to override, remove the rest for simplicity and an easy overview.Override the code health rules by changing the default 1.0 value to a lower relative weight. A value of 0.0 disables the rule. A value of 0.5 still implies a code health hit but only at 50% of the default impact. Note that you can specify multiple rule sets and use the matching-content-path to control to which parts or languages the rules apply. This makes it possible to differentiate between test vs application code, or tailor rules to specific languages. In case multiple rule sets match a piece of content, then we prioritize the first mathcing set of rules.",
"rule_sets" : [ {
"thresholds" : [ {
"name" : "constructor_max_arguments",
"value" : "-"
}, {
"name" : "file_lines_of_code_for_alert",
"value" : "-"
}, {
"name" : "file_lines_of_code_for_critical_alert",
"value" : "-"
}, {
"name" : "file_lines_of_code_for_warning",
"value" : "-"
}, {
"name" : "file_mean_cyclomatic_complexity_warning",
"value" : "-"
}, {
"name" : "file_primitive_obsession_percentage_for_warning",
"value" : "-"
}, {
"name" : "function_bumpy_road_bumps_for_warning",
"value" : "-"
}, {
"name" : "function_bumpy_road_nesting_level_depth",
"value" : "-"
}, {
"name" : "function_complex_conditional_branches_alert",
"value" : "-"
}, {
"name" : "function_complex_conditional_branches_warning",
"value" : "-"
}, {
"name" : "function_cyclomatic_complexity_alert",
"value" : "-"
}, {
"name" : "function_cyclomatic_complexity_warning",
"value" : "-"
}, {
"name" : "function_embedded_content_lines_of_code_alert",
"value" : "-"
}, {
"name" : "function_embedded_content_lines_of_code_warning",
"value" : "-"
}, {
"name" : "function_lines_of_code_alert",
"value" : "-"
}, {
"name" : "function_lines_of_code_warning",
"value" : "-"
}, {
"name" : "function_max_arguments",
"value" : "-"
}, {
"name" : "function_nesting_depth_warning",
"value" : "-"
}, {
"name" : "unit_test_consecutive_asserts_for_large_block",
"value" : "-"
}, {
"name" : "unit_test_suite_number_of_large_assertion_blocks",
"value" : "-"
} ],
"thresholds_doc" : "The thresholds let you redefine the details of the code health issues. For example, specifying what a Complex Method means to you. Be restrictive with overrides.",
"matching_content_path" : "**/*",
"matching_content_path_doc" : "Specify a glob pattern relative to this repo root. **/* means all code, **/*.js means just JavaScript, test/** means all code in a top-level test folder.",
"rules" : [ {
"name" : "Brain Method",
"weight" : 1.0
}, {
"name" : "Bumpy Road Ahead",
"weight" : 1.0
}, {
"name" : "Code Duplication",
"weight" : 1.0
}, {
"name" : "Complex Conditional",
"weight" : 1.0
}, {
"name" : "Complex Method",
"weight" : 1.0
}, {
"name" : "Constructor Over-Injection",
"weight" : 1.0
}, {
"name" : "Deep, Global Nested Complexity",
"weight" : 1.0
}, {
"name" : "Deep, Nested Complexity",
"weight" : 1.0
}, {
"name" : "Duplicated Assertion Blocks",
"weight" : 1.0
}, {
"name" : "Excess Number of Function Arguments",
"weight" : 1.0
}, {
"name" : "Global Conditionals",
"weight" : 1.0
}, {
"name" : "Large Assertion Blocks",
"weight" : 1.0
}, {
"name" : "Large Embedded Code Block",
"weight" : 1.0
}, {
"name" : "Large Method",
"weight" : 100.0
}, {
"name" : "Lines of Code in a Single File",
"weight" : 1.0
}, {
"name" : "Lines of Declarations in a Single File",
"weight" : 1.0
}, {
"name" : "Low Cohesion",
"weight" : 1.0
}, {
"name" : "Missing Arguments Abstractions",
"weight" : 1.0
}, {
"name" : "Number of Functions in a Single Module",
"weight" : 1.0
}, {
"name" : "Overall Code Complexity",
"weight" : 1.0
}, {
"name" : "Overall Function Size",
"weight" : 1.0
}, {
"name" : "Primitive Obsession",
"weight" : 1.0
}, {
"name" : "String Heavy Function Arguments",
"weight" : 1.0
} ]
} ]
}
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ jobs:
- run: npm --prefix auth_service ci
- run: npm --prefix webapp ci
- run: npm --prefix game_service ci
- run: npm --prefix friends_service ci
- run: npm --prefix userdetails_service test -- --coverage
- run: npm --prefix question_service test -- --coverage
- run: npm --prefix auth_service test
- run: npm --prefix webapp test -- --coverage
- run: npm --prefix game_service test -- --coverage
- run: npm --prefix friends_service test -- --coverage
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
Expand Down
70 changes: 51 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,41 @@ jobs:
- run: npm --prefix auth_service ci
- run: npm --prefix webapp ci
- run: npm --prefix game_service ci
- run: npm --prefix friends_service ci
- run: npm --prefix userdetails_service test -- --coverage
- run: npm --prefix question_service test -- --coverage
- run: npm --prefix auth_service test
- run: npm --prefix webapp test -- --coverage
- run: npm --prefix game_service test -- --coverage
- run: npm --prefix friends_service test -- --coverage
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# e2e-tests:
# needs: [unit-tests]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# - run: npm --prefix auth_service install
# - run: npm --prefix webapp install
# - run: npm --prefix webapp run build
# - run: npm --prefix webapp run test:e2e
e2e-tests:
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm --prefix auth_service install
- run: npm --prefix game_service install
- run: npm --prefix userdetails_service install
- run: npm --prefix question_service install
- run: npm --prefix friends_service install
- run: npm --prefix webapp install
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [unit-tests]
needs: [ e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -65,7 +71,7 @@ jobs:
permissions:
contents: read
packages: write
needs: [unit-tests]
needs: [ e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -76,13 +82,30 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: userdetails_service
docker-push-friends:
name: Push friends service Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [ e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/wiq_es1c/friends
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: friends_service
docker-push-game:
name: Push game service Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [unit-tests]
needs: [ e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -99,7 +122,7 @@ jobs:
permissions:
contents: read
packages: write
needs: [unit-tests]
needs: [ e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -116,7 +139,7 @@ jobs:
permissions:
contents: read
packages: write
needs: [unit-tests]
needs: [ e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -130,7 +153,7 @@ jobs:
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-auth,docker-push-question,docker-push-userdetails,docker-push-webapp,docker-push-game]
needs: [docker-push-auth,docker-push-question,docker-push-userdetails,docker-push-webapp,docker-push-game,docker-push-friends]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
Expand All @@ -139,7 +162,16 @@ jobs:
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
mkdir grafana
mkdir grafana/provisioning
mkdir grafana/provisioning/dashboards
mkdir grafana/provisioning/datasources
mkdir prometheus
wget https://raw.githubusercontent.com/arquisoft/wiq_es1c/master/grafana/provisioning/datasources/datasource.yml -O grafana/provisioning/datasources/datasource.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_es1c/master/grafana/provisioning/dashboards/dashboard.yml -O grafana/provisioning/dashboards/dashboard.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_es1c/master/grafana/provisioning/dashboards/apiDashboard.json -O grafana/provisioning/dashboards/apiDashboard.json
wget https://raw.githubusercontent.com/arquisoft/wiq_es1c/master/prometheus/prometheus.yml -O prometheus/prometheus.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_es1c/master/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_es1c/master/.env -O .env
docker compose --profile prod down
docker compose --profile prod up -d --pull always
docker compose --profile prod up -d --pull always
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
coverage
testDB.sqlite
**/*.sqlite
docs/build
.idea
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@

[![Deploy on release](https://github.com/Arquisoft/wiq_es1c/actions/workflows/release.yml/badge.svg)](https://github.com/Arquisoft/wiq_es1c/actions/workflows/release.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_es1c&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_es1c)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_es1c&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_es1c) [![Open Issues](https://img.shields.io/github/issues-raw/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/issues) [![Closed Issues](https://img.shields.io/github/issues-closed-raw/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/issues?q=is%3Aissue+is%3Aclosed) [![Pull Requests](https://img.shields.io/github/issues-pr/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/pulls) [![License](https://img.shields.io/github/license/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/blob/main/LICENSE) [![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_es1c&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_es1c) [![Open Issues](https://img.shields.io/github/issues-raw/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/issues) [![Closed Issues](https://img.shields.io/github/issues-closed-raw/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/issues?q=is%3Aissue+is%3Aclosed) [![Pull Requests](https://img.shields.io/github/issues-pr/Arquisoft/wiq_es1c)](https://github.com/Arquisoft/wiq_es1c/pulls) [![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)
[![CodeScene Code Health](https://codescene.io/projects/52509/status-badges/code-health)](https://codescene.io/projects/52509) [![CodeScene System Mastery](https://codescene.io/projects/52509/status-badges/system-mastery)](https://codescene.io/projects/52509) [![CodeScene general](https://codescene.io/images/analyzed-by-codescene-badge.svg)](https://codescene.io/projects/52509)


[![Website](https://github.com/Arquisoft/wiq_es1c/blob/master/media/img/wiq_banner_readme.png)](http://wiqgame.run.place/)

This is a base repo for the [Software Architecture course](http://arquisoft.github.io/) in [2023/2024 edition](https://arquisoft.github.io/course2324.html).
<p align="center">
<a href = "http://wiqgame.run.place/" title= "Pagina web">
<img src="https://github.com/Arquisoft/wiq_es1c/blob/master/media/img/wiq_banner_readme.png">
</a>
</p>

This repo is a basic application composed of several components.

- **User service**. Express service that handles the insertion of new users in the system.
- **Auth service**. Express service that handles the authentication of users.
- **Game service**. Express service that handles the game itself.
- **Friend service**. Express service that handles the friends.
- **Question service**. Express service that handles the questions generation and distribution.
- **Webapp**. React web application that uses the gateway service to allow basic login and new user features.

Every service has its own MariaDB database in addition the question and game service have a MongoDB database for managing the questions and the communication with the Wikidata services.



## Description

This project has been developed by the contributors listed in the following section, as part of the **Software Architecture course at the University of Oviedo** for the academic year 2023/2024.
Expand Down
4 changes: 4 additions & 0 deletions auth_service/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const YAML = require('yaml')

// My own libs
const auth = require('./auth/authEndpoints');
const user = require('./user/userEndpoints')

const port = 8001;
const app = express();
Expand All @@ -28,6 +29,9 @@ app.post("/api/auth/register", auth.register);
app.post("/api/auth/login", auth.login);
app.post("/api/auth/verify", auth.verify);
app.post("/api/auth/getName", auth.getUsername);
app.get("/api/user/getUsers", user.getUsers);
app.get("/api/user/getUser", user.getUser);
app.post("/api/user/deleteUser", user.deleteUser);
app.get('/health', (req, res) => {
res.json({ status: 'OK' });
});
Expand Down
Loading

0 comments on commit d0f4d87

Please sign in to comment.