Skip to content

Individual Contribution Report 2(Erkam Kavak)

Erkam Kavak edited this page May 12, 2023 · 2 revisions

Links to essential issues (git issues)

  • #152 Learning Flask API and Git
  • #160 Researching and implementing Steam API
  • #169 Dockerizing and publishing to AWS EC2
  • #179 Change database structure
  • #197 Adding tests for get game information API

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

I used the Steam API for getting information about games which are available at Steam. I thought it will be useful for the next semester since we may have Game pages for each game and we can show informations about them in their page. It provides short and detailed description about the game. Also it provides screenshots about the game and the categories of the game. Since there is no URL for getting information of a game from its name, I used two different URL's from Steam API. One of them is for pulling list of games from Steam API (https://api.steampowered.com/ISteamApps/GetAppList/v2/) and the other one is pulling information about the game from its id(https://store.steampowered.com/api/appdetails?appids={game_id}). I used the first URL for pulling game id of the game from its name and the second one for pulling game information of the game from its id.

API Functions

I have created three different functions. These three different function includes 1 GET and 3 POST request. These functions are as follows:

  • get_game_information-GET: Returns the initial page of the API. It returns an HTML page which contains searchbar for searching games.

  • get_game_information-POST: Returns the information about the game which is given as of its name in the request. Game name should be given as 'game_name'. It will pull the information about the game using Steam API and it will return an HTML page containing the game informations. If there occurs any problem such as 'Game is not found' or 'Game name is not entered', it returns the initial page with the error.

  • add_to_favorites-POST: Adds the game to the favorites of the user and returns the log of the operation. Name and id of the game should be given in the request as 'game_name' and 'game_id'. This is a login_required function which requires the user to be logged in the website before. It uses the id of the user to save the game as favorite for that user on the database. If returns log of "Game already added to favorites for this user!" if the game was previously added for that user.

  • show_all_favorites-POST: Pulls all the favorite games for the current user. Since it pulls the information from the user's id, it requires no information in the request. It filters the games from the database with user's id and returns all the filtered games in an html page. The page lists filtered game's names.

These functions allow for seeing information about the games, adding new games to favorites and looking at the favorites games later.

Unit Tests

I created 8 different tests. 3 for signing and logging on the website, 2 for getting game information and 2 for adding and pulling favorite games.

  • Signup, login and invalid login tests: image

  • Logout test: image

  • Getting game information and posting(searching) game information tests: image

  • Adding game to favorites and showing added favorite games tests: image

You can test these unittest by cloning our repository and running pytest command in the tests folder.

Sample Calls

image

image

Other Significant Work

I created the docker and docker-compose files for dockerization. I published the docker container on an AWS free tier Ec2 instance. I reviewed lots of PRs with detailed inspections.

Challenges

Sending ajax request from html and returning to the same page using Javascript was hard for me since I don't have much experience with javascript. Creating unit tests for sign-up and login on flask was another hard thing for me to do because there were not much resources about it. Lastly the hardest one was creating a docker-compose file for running both postgres and our web-app on the docker container. It was hard because it was about postgres and docker 😄

Clone this wiki locally