diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44986fd..9c474c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,9 +12,16 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - run: npm --prefix questionservice ci + - run: npm --prefix userservice/authservice ci + - run: npm --prefix userservice/userservice ci + - run: npm --prefix gatewayservice ci - run: npm --prefix webapp ci - #- run: npm --prefix webapp test -- --coverage + - run: npm --prefix questionservice ci + - run: npm --prefix userservice/authservice test -- --coverage + - run: npm --prefix userservice/userservice test -- --coverage + - run: npm --prefix gatewayservice test -- --coverage + - run: npm --prefix webapp test -- --coverage + - run: npm --prefix questionservice test -- --coverage - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: @@ -28,10 +35,13 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 + - run: npm --prefix userservice/authservice install + - run: npm --prefix userservice/userservice install + - run: npm --prefix gatewayservice install - run: npm --prefix questionservice install - run: npm --prefix webapp install - run: npm --prefix webapp run build - #- run: npm --prefix webapp run test:e2e + - run: npm --prefix webapp run test:e2e docker-push-webapp: name: Push webapp Docker Image to GitHub Packages runs-on: ubuntu-latest @@ -52,6 +62,57 @@ jobs: registry: ghcr.io workdir: webapp buildargs: API_URI + docker-push-authservice: + name: Push auth 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_es05a/authservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: users/authservice + docker-push-userservice: + name: Push user 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_es05a/userservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: users/userservice + docker-push-gatewayservice: + name: Push gateway 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_es05a/gatewayservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: gatewayservice docker-push-questionservice: name: Push questionservice Docker Image to GitHub Packages runs-on: ubuntu-latest @@ -72,7 +133,12 @@ jobs: deploy: name: Deploy over SSH runs-on: ubuntu-latest - needs: [docker-push-questionservice,docker-push-webapp] + needs: + - docker-push-userservice + - docker-push-authservice + - docker-push-gatewayservice + - docker-push-questionservice + - docker-push-webapp steps: - name: Deploy over SSH uses: fifsky/ssh-action@master diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..a50ccf6 --- /dev/null +++ b/debug.log @@ -0,0 +1 @@ +[0404/101930.492:ERROR:registration_protocol_win.cc(107)] CreateFile: El sistema no puede encontrar el archivo especificado. (0x2) diff --git a/docs/images/07_DiagramaDespliegue3.PNG b/docs/images/07_DiagramaDespliegue3.PNG new file mode 100644 index 0000000..6eae1bc Binary files /dev/null and b/docs/images/07_DiagramaDespliegue3.PNG differ diff --git a/docs/images/07_diagramaDespliegue2.png b/docs/images/07_diagramaDespliegue2.png deleted file mode 100644 index 5e6b127..0000000 Binary files a/docs/images/07_diagramaDespliegue2.png and /dev/null differ diff --git a/docs/src/07_deployment_view.adoc b/docs/src/07_deployment_view.adoc index c662c61..8c4ae58 100644 --- a/docs/src/07_deployment_view.adoc +++ b/docs/src/07_deployment_view.adoc @@ -56,7 +56,7 @@ Describe (usually in a combination of diagrams, tables, and text): For multiple environments or alternative deployments please copy and adapt this section of arc42 for all relevant environments. **** -image::07_diagramaDespliegue2.png["Diagrama de despliegue"] +image::07_diagramaDespliegue3.png["Diagrama de despliegue"] MotivaciĆ³n:: diff --git a/gatewayservice/gateway-service.test.js b/gatewayservice/gateway-service.test.js index 56eeb12..580d737 100644 --- a/gatewayservice/gateway-service.test.js +++ b/gatewayservice/gateway-service.test.js @@ -37,4 +37,5 @@ describe('Gateway Service', () => { expect(response.statusCode).toBe(200); expect(response.body.userId).toBe('mockedUserId'); }); + //test prueba gateway }); \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties index 20426e1..90d5c49 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -10,9 +10,9 @@ sonar.host.url=https://sonarcloud.io sonar.language=js sonar.projectName=wiq_es05a -#sonar.coverage.exclusions=**/*.test.js +sonar.coverage.exclusions=**/*.test.js sonar.coverage.exclusions=* -sonar.sources=webapp/src/components,userservice/authservice,userservice/userservice,gatewayservice +sonar.sources=webapp/src/components,userservice/authservice,userservice/userservice,gatewayservice, questionservice sonar.sourceEncoding=UTF-8 sonar.exclusions=node_modules/** sonar.javascript.lcov.reportPaths=**/coverage/lcov.info diff --git a/webapp/src/App.js b/webapp/src/App.js index a5c5132..1a23d35 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -54,7 +54,7 @@ function App() { } />} + element={} />} /> diff --git a/webapp/src/components/Pages/Estadisticas.js b/webapp/src/components/Pages/Estadisticas.js index 1d085c4..72562a0 100644 --- a/webapp/src/components/Pages/Estadisticas.js +++ b/webapp/src/components/Pages/Estadisticas.js @@ -5,10 +5,10 @@ import '../Estilos/estadisticas.css'; import axios from 'axios'; -const Estadisticas = ({isLogged}) => { +const Estadisticas = ({isLogged, username}) => { const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; - const [username, setUsername] = useState(''); + // const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [correctAnswers, setCorrectAnswers] = useState(0); @@ -28,11 +28,13 @@ const Estadisticas = ({isLogged}) => { async function statsUser(){ try { const response = await axios.get(`${apiEndpoint}/getUserData?username=${username}`); + console.log('Datos obtenidos con exito:', response.data); + console.log('Datos obtenidos con exito:', response.data.user.correctAnswers); const datos = response.data; - setCorrectAnswers(datos.correctAnswers); - setIncorrectAnswers(datos.incorrectAnswers); - setCompletedGames(datos.completedGames); - setAverageTime(datos.averageTime); + setCorrectAnswers(datos.user.correctAnswers); + setIncorrectAnswers(datos.user.incorrectAnswers); + setCompletedGames(datos.user.completedGames); + setAverageTime(datos.user.averageTime); } catch (error) { setError(error.response.data.error); }