Individual Contribution Report 2 | Beyzanur Bektan - bounswe/bounswe2023group6 GitHub Wiki

Member

Name: Beyzanur Bektan

Links to important issues

The name, route, and description of utilized third-party URIs

Utilized Third-Party URI:

Description: The project made use of the FreeToGame API, which is available through the URI https://www.freetogame.com/api-doc. The specific endpoint that was utilized for this project is the "Games by category or tag" endpoint, accessed through the URI https://www.freetogame.com/api/games?category=shooter.

The FreeToGame API provides a comprehensive database of free-to-play games, and the specified endpoint allows for retrieving games that fall under the "shooter" category. By making a GET request to this URI, the project was able to fetch a list of shooter games available on the FreeToGame platform.

This API was chosen due to its extensive collection of games, which aligns with the project's focus on providing information about various gaming genres. The endpoint's ability to filter games by category facilitated the retrieval of relevant data, specifically focusing on shooter games.

The name, route, and description of the created API functions

Name: find_free_games

Route: /find-free-games

Description: This function handles the retrieval of free games based on a specified tag. It accepts both GET and POST requests. When a POST request is made, the function retrieves the tag from the form data and sends a request to the FreeToGame API to fetch games in the specified category. The function then processes the response and extracts relevant information such as game names and short descriptions. Finally, it renders the find_free_games.html template, passing the retrieved games as a parameter.

Name: like_game

Route: /like_game

Description: This function allows authenticated users to like a game. It handles POST requests and expects the game name and game ID as form data. If the game ID is provided, the function queries the LikedGame table to check if the game has already been liked by the current user. Otherwise, it creates a new LikedGame object and adds it to the session, committing the changes to the database. Finally, the function redirects the user back to the find_free_games page.

Name: see_liked_games

Route: /see_liked_games

Description: This function allows authenticated users to view a list of games they have liked. It handles GET requests and retrieves all LikedGame objects associated with the current user from the database. The function then renders the see_liked_games.html template, passing the retrieved liked games as a parameter.

Name: dislike_game

Route: /dislike_game

Description: This function allows authenticated users to dislike a game. It handles POST requests and expects the game name and game ID as form data. It then queries the DislikedGame table to check if the game has already been disliked by the current user. Otherwise, it creates a new DislikedGame object, adds it to the session, and commits the changes to the database. Finally, the function redirects the user back to the find_free_games page.

Name: see_disliked_games

Route: /see_disliked_games

Description: This function allows authenticated users to view a list of games they have disliked. It handles GET requests and retrieves all DislikedGame objects associated with the current user from the database. The function then renders the see_disliked_games.html template, passing the retrieved disliked games as a parameter.

1. find_free_games

Request:

GET /find-free-games HTTP/1.1
Host: localhost:5000

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "games": [
    {
      "game_name": "Game 1",
      "game_short_description": "Short description of Game 1"
    },
    {
      "game_name": "Game 2",
      "game_short_description": "Short description of Game 2"
    },
    {
      "game_name": "Game 3",
      "game_short_description": "Short description of Game 3"
    }
  ]
}

2. like_game

Request:

POST /like_game HTTP/1.1
Host: localhost:5000
Content-Type: application/json

{
  "game_name": "Game 1",
  "game_id": 123
}

Response:

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8

<html>
<body>
  <h1>Game liked!</h1>
</body>
</html>

3. see_liked_games

Request:

GET /see_liked_games HTTP/1.1
Host: localhost:5000

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "liked_games": [
    {
      "game_name": "Game 1",
      "game_id": 123
    },
    {
      "game_name": "Game 3",
      "game_id": 456
    }
  ]
}

Challenges

During the implementation phase, I faced challenges with certain aspects such as making pull requests on GitHub, as well as working with Flask and PostgreSQL, which were new to me. As a beginner, I found these tasks to be particularly difficult. However, I approached these challenges with determination and utilized available resources such as documentation and tutorials to overcome them. Through this experience, I gained valuable knowledge and a deeper understanding of GitHub, Flask, and PostgreSQL. Overall, despite the initial difficulties, I embraced the learning process and achieved significant growth in my skills and understanding. Unfortunately, due to time constraints, I was unable to allocate sufficient time for writing unit tests.

⚠️ **GitHub.com Fallback** ⚠️