Skip to content

Commit

Permalink
fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
adriiglz committed Apr 27, 2024
2 parents 2f2614f + 74779bd commit 26270a1
Show file tree
Hide file tree
Showing 22 changed files with 840 additions and 236 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ jobs:
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 users/authservice install
# - run: npm --prefix users/userservice install
# - run: npm --prefix gatewayservice install
# - run: npm --prefix webapp install
# - run: CI=false npm --prefix webapp run build
# - run: CI=true 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 users/authservice install
- run: npm --prefix users/userservice install
- run: npm --prefix gatewayservice install
- run: npm --prefix webapp install
- run: CI=false npm --prefix webapp run build
- run: CI=true npm --prefix webapp run test:e2e

docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ARM64
permissions:
contents: read
packages: write
# needs: [e2e-tests]
needs: [unit-tests]
needs: [e2e-tests]
# needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -67,8 +67,8 @@ jobs:
permissions:
contents: read
packages: write
# needs: [e2e-tests]
needs: [unit-tests]
needs: [e2e-tests]
# needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -85,8 +85,8 @@ jobs:
permissions:
contents: read
packages: write
# needs: [e2e-tests]
needs: [unit-tests]
needs: [e2e-tests]
# needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -103,8 +103,8 @@ jobs:
permissions:
contents: read
packages: write
# needs: [e2e-tests]
needs: [unit-tests]
needs: [e2e-tests]
# needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -121,8 +121,8 @@ jobs:
permissions:
contents: read
packages: write
# needs: [e2e-tests]
needs: [unit-tests]
needs: [e2e-tests]
# needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ services:
depends_on:
- gatewayservice
ports:
- "80:80"
- "3000:3000"
# platform: linux/arm64


Expand Down
10 changes: 7 additions & 3 deletions docs/src/01_introduction_and_goals.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ These include
* quality goals for the architecture and
* relevant stakeholders and their expectations
****
In these points, the main goals and functional requirements will be explained. In order to give context on how the webapp will be developed.

This project's aim, in summary, is developing a public web application which has a game consisting on answering multiple choice questions
with one correct answer generated using Wikidata. For reference of the general mechanic, see the spanish quiz program 'Saber y Ganar' and
its game mode 'Descartando'

Next, important basic aspects of the project will be described in order to give context on how the webapp will be developed.

=== Requirements Overview

Expand Down Expand Up @@ -142,10 +147,9 @@ Table with role names, person names, and their expectations with respect to the

[options="header",cols="1,2,2"]
|===
|Role/Name|Contact|Expectations
|Role/Name|Members|Expectations
| *Students* | Andrés Cadenas Blanco, Christian Fernandez Noriega , Adrián González Guadalupe and Luis Salvador Ferrero | Are the ones in charge of web development. They will work together to make the application.
| *Teachers* | Pablo González | In charge of supervising the student's teamwork, ensuring the work accomplishes the goals in the best way possible and helping in the development and solving doubts.
| *Bussineses* | RTve has hired software development company HappySw | Emphasis the SOLID part of the web and have a high understanding of this area
| *Users* | Anyone that wants to use the web | They should be able to understand how to use and move around the web with ease
|===

16 changes: 9 additions & 7 deletions docs/src/03_system_scope_and_context.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ the past games of all users in a ranking.
----
actor Player
[Wikidata] <<external>>
database MongoDB
[WIQ Game] <<system>>
[UsersAPI] <<internal>>
[questionsAPI] <<internal>>
[QuestionsAPI] <<internal>>
Player ..> (WIQ Game) : register/login
[questionsAPI] ..> Wikidata
[QuestionsAPI] ..> Wikidata
[WIQ Game] ..> UsersAPI
[WIQ Game] ..> questionsAPI
[WIQ Game] ..> QuestionsAPI
[UsersAPI] <--> MongoDB
----

[cols="e,2e" options="header"]
Expand All @@ -80,12 +82,12 @@ Player ..> (WIQ Game) : register/login
|Wikidata
|External data repository from which questions are generated

|MongoDB
|Database for storing players' info and scores

|Users Info API
|Manages data of users, both registration/login data and their past scores

|questions API
|Questions API
|Manages generation of questions from Wikidata

|MongoDB
|Database for storing players' info and scores
|===
15 changes: 5 additions & 10 deletions docs/src/05_building_block_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ actor Player
rectangle "WIQ Game (Level 1)"{
[WIQ Game GUI]
[UsersAPI]
[questionsAPI] #BurlyWood
[QuestionsAPI] #BurlyWood
Player ..> (WIQ Game GUI)
[questionsAPI] ..> Wikidata
[QuestionsAPI] ..> Wikidata
[WIQ Game GUI] ..> UsersAPI
[WIQ Game GUI] ..> questionsAPI
[WIQ Game GUI] ..> QuestionsAPI
}
----

Expand Down Expand Up @@ -153,7 +153,7 @@ Please prefer relevance over completeness. Specify important, surprising, risky,
Leave out normal, simple, boring or standardized parts of your system
****

==== questions API (White Box)
==== Questions API (White Box)

This is the Component that holds the functionallity for the main purpose of the webapp: Allowing players to see questions and
answer them, getting a consequent score update.
Expand All @@ -163,17 +163,15 @@ answer them, getting a consequent score update.
...describes the internal structure of _building block 1_.
****

[plantuml,"questions API (WhiteBox)",png]
[plantuml,"Questions API (WhiteBox)",png]
----
[Wikidata]
[wikibase-sdk] <<library>>
[WIQ Game GUI]
database MongoDB
rectangle "questionsAPI (Level 2)"{
[question-service] ..> [wikibase-sdk]
[question-service] ..> [Wikidata]
[question-service] <--> MongoDB
[WIQ Game GUI] ..> [question-service] : new question
[WIQ Game GUI] ..> [question-service] : validate answer
}
Expand All @@ -195,7 +193,4 @@ Contained Black boxes::
|wikibase-sdk
|External library that facilitates and simplifies the use of wikidata for the generation of questions.

|MongoDB
|Data about users and their scores is stored here

|===
2 changes: 1 addition & 1 deletion docs/src/06_runtime_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ GW -> WEBC: Send category statistics
actor User
entity WEBC as "Web Client"
entity GW as "Gateway"
database DB as "MongoDB"
entity QU as "Questions API"
entity USERS as "Users Service API"
database DB as "MongoDB"
User -> WEBC: Select a category to play
WEBC -> GW: Get a question
Expand Down
3 changes: 0 additions & 3 deletions docs/src/07_deployment_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ MDB-[dashed]->AS
US-[dashed]->MDB
MDB-[dashed]->US
QS-[dashed]->MDB
MDB-[dashed]->QS
----
The architecture of WIQ is based on microservices. Gateway service is the main entry point for the system. The web application is the main interface for the user to interact with the system. The user service is responsible for managing users. The authorization service is responsible for managing user permissions. The question service is responsible for generating questions. The mongo database is used to store data.

Expand Down
9 changes: 9 additions & 0 deletions docs/src/08_concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ image::08-Crosscutting-Concepts-Structure-EN.png["Possible topics for crosscutti
See https://docs.arc42.org/section-8/[Concepts] in the arc42 documentation.
****

=== _Continuous integration and development_

Our way of working with github is having one developing branch towards which all pull requests are done
and have to be reviewed by at least one team member.
Sonar Cloud is set up so we know the testing coverage and whether we pass the quality gate with every pull request.
Once there is enough change in the develop branch with respect to the main one and it has enough quality we can
merge them and make a release.


=== _Microservice based system_

Different business functionallities will be developed in different independent services.
Expand Down
1 change: 1 addition & 0 deletions users/authservice/auth-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ app.use(express.json());

// Connect to MongoDB
const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/wiq-en1a-users';

mongoose.connect(mongoUri);

// Function to validate required fields in the request body
Expand Down
2 changes: 2 additions & 0 deletions users/userservice/user-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ app.use(bodyParser.json());
// Connect to MongoDB
const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/wiq-en1a-users';
mongoose.connect(mongoUri);
console.log(mongoUri);



Expand Down Expand Up @@ -116,6 +117,7 @@ app.get('/ranking/user', async (req, res) => {

app.post('/adduser', async (req, res) => {
try {
console.log(mongoUri);
// Check if required fields are present in the request body
validateRequiredFields(req, ['username','email', 'password']);

Expand Down
18 changes: 14 additions & 4 deletions webapp/e2e/features/login-form.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Feature: Registering a new user
Feature: Login a registered user

Scenario: The user is registered in the site
Given A registered user
When I fill the data in the form and press submit
Then is logged
Given An registered user
When I fill the data in the form to log in
Then is taken to the home page

Scenario: User logs in with invalid credentials
Given a registered user with username "testUser" and password "testpass"
When I fill the login form with username "testUser" and incorrect password "wrongpass"
And I remain on the login page

Scenario: User attempts to login without entering credentials
Given a registered user with username "testUser" and password "testpass"
When I attempt to log in without entering any credentials
And I remain on the login page
17 changes: 17 additions & 0 deletions webapp/e2e/features/userprofile-form.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: View and Change User Quiz Rankings

Scenario: Viewing Global Rankings
Given the user navigates to their profile
When they select the "Global" category
Then they see their performance statistics for global quizzes

Scenario: Switching Category to Flags
Given the user is on their profile page
When they click on the "Flags" category
Then they view their performance metrics for flag-related quizzes

Scenario: Switching Category to Food
Given the user is on their profile page
When they click on the "Food" category
Then they view their performance metrics for food-related quizzes

Loading

0 comments on commit 26270a1

Please sign in to comment.