Member Contribution Report (Yunus Emre Altuğ) - bounswe/bounswe2023group7 GitHub Wiki

Yunus Emre Altuğ

Section Name: bounswe2023group7

Issues

  • #143 Searching for API.
  • #144 Learning the basics: NodeJs, JSON.
  • #145 Learning the basics: Docker, Swagger, Testing
  • #159 Giving Information About Game Platform Feature to Practice API
  • #189 Frontend of Platform App
  • #204 Yunus Emre Altuğ Individual Report
  • #215 Practice app/feature/game platforms, pull request of my part.
  • #216 Dockerization of the practice app
  • #217 Creating a remote database for backend of the practice app.

The Information About Utilized Third Party URI

Name: Moby Games API MobyGames is an extremely ambitious project with the goal to meticulously catalog all relevant information about electronic games (computer, console, and arcade) on a game-by-game basis. Including release info, credits, cover art, player-taken screenshots and descriptions, and much more!

In short, it's a gigantic game database and our attempt to preserve the rich history behind electronic gaming, including the companies and people who made them.

Requests to the API are authenticated using a private API key. API requests are limited to 360 per hour (one every ten seconds). In addition, requests should be made no more frequently than one per second.

Route that I used for searchGame:

"https://api.mobygames.com/v1/games?limit=10&format=brief&title={user input}&api_key={key}"

The request sends a json with one key named "games" and value array. Array has 10 json objects maximum. Each json object has moby games URL of the game, game id and title. Key is received from Moby Games free with signing up. User input is what user wants to search. The external API takes, limit, format, title and api_key parameters. Parameters are not required. Some of them have actually default values such as limit=100. The site allows other parameters such as platform, id but this is not aimed in my api, so I did not use them. Limit is 10 for showing 10 related games with searched keyword. Format can be brief, normal and id and I used brief to get title, id and URL of the Moby Games page of the game. Title is basically a parameter for its name. For instance, when you get request as:

"https://api.mobygames.com/v1/games?limit=10&format=brief&title=prince of&api_key={key}"

One of the results can be "Prince of Persia". To find the game, including keyword will be sufficient.

Route that I used for getPlatform:

"https://api.mobygames.com/v1/games?format=normal&id={moby games id of the game}&api_key={key}"

The request sends a json with one key named "games" and value array. These array has many proporties some of which are description, alternate titles, genres, platforms. This format is very descriptive. To get response, user should enter the game id what he or she wants to find. I used platforms here in the function. If request has success, the json will have games array which has only one element. For instance:

"https://api.mobygames.com/v1/games?format=normal&id=11185&api_key={key}"

The value array only have "Prince of Persia the Sands of Time" game information.

Route that I used for postMyPlatform:

"https://api.mobygames.com/v1/platforms?api_key={key}"

The request sends a json with one key named "platforms" and value array. These array has all platforms some of which are description, alternate titles, genres, platforms. This format is very descriptive. To get response, user should enter the game id what he or she wants to find. I used platforms here in the function. If request has success, the json will have games array which has only one element. The request has no parameter. The value array of platforms, has platform objects which have platform id and platform name.

To be informed more you can visit the official documentation Moby Games API

The Information About Created API Functions

The use these requests you should get authentication key.

  • searchGame - GET:

api/game-platform/searchGame?title={keyword}
This function retrieves the games list for user wants to search. The request takes parameter as title. Title does not distinguish lower or uppercase letters, and able to take " ". The request sends the data exactly which received from external API. If keyword is empty, the request will send 400 as bad request. If keyword does not help to find any game, request sends 404. If keyword is longer than 128, request will send 422. Also due to external api, request may send 429 as I described above. The game name is used in frontend. The title parameter is required not to take 400 error. If any error happens except them, request directly sends 500.

  • getPlatforms - GET:

api/game-platform/searchGame?id={keyword}
This function returns the platforms of a game. The request takes parameter as id. The request sends json. It has a platforms key which came from platforms value of external API and message value. This message value is created in function. If user does not have any platform of the game, message tells user that user does not have any of them. Otherwise, the first platform which met the requirements is send in message. If id is empty or does not belong a game request will send 404 error. Also due to external api, request may send 429 as I described above. The game name is used in frontend. The title parameter is required not to take 400 error. If any error happens except them, request directly sends 500.

  • postMyPlatform - POST:

api/game-platform/platform?title={keyword}
This function posts database username, platform id and platform name. The request takes parameter as title. Title does not distinguish lower or uppercase letters, and able to take " ". The request sends a message. If keyword is empty, the request will send 400 as bad request. If keyword does not help to find the searched platform, request sends 404. Also due to external api, request may send 429 as I described above. The game name is used in frontend. The title parameter is required not to take 400 error. If any error happens except them, request directly sends 500.

Unit Tests

I have 16 tests for these requests. 6 tests for searchGame request, 4 tests for getPlatforms and 6 tests for postMyPlatform. The first five tests have authentication key. Not to get 429, I put between tests waiting function. Therefore, the test may take time.

  • First test searchs title with lowercased letters. I give title as "god of war". The response status should be 200 and have games proporty.
  • Second test searchs title with no title. I give title as "". The response status should be 400.
  • Third test searchs title with uppercased and lowercased. I give title as "gOD OF WAr Ii". The response status should be 200 and have games proporty.
  • Fourth test searchs title with non existed game. I give title as "pokemon dark blue". The response status should be 404.
  • Fifth test searchs title with long keyword. I give title as "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa". The response status should be 422.
  • Sixth test searchs title with relevant keyword but does not have authentication. The response status should be 401.
  • Seventh test finds game with relevant id. I give id as "01". The response status should be 200 and have platforms proporty.
  • Eighth test tries to find game without id. I give id as "". The response status should be 404.
  • Ninth test tries to find game with urrelevant id. I give id as "100000000". The response status should be 404.
  • Tenth test tries to find game with relevant id but without accessToken. The response status should be 401.
  • Sixth test searchs title with relevant keyword but does not have authentication. The response status should be 401.
  • Seventh test finds game with relevant id. I give id as "01". The response status should be 200 and have platforms proporty.
  • Eighth test tries to find game without id. I give id as "". The response status should be 404.
  • Ninth test tries to find game with urrelevant id. I give id as "100000000". The response status should be 404.
  • Tenth test tries to find game with relevant id but without accessToken. The response status should be 401.
  • Eleventh test posts platform with relevant keyword a user The response status should be 200.
  • Twelfth test posts platform with another relevant keyword to same user. The response status should be 200.
  • Thirteenth test posts platform with urrelevant keyword to same user. The response status should be 404.
  • Fourteenth test posts platform with empty keyword to same user. The response status should be 400.
  • Fifteenth test posts platform with relevant keyword to same user but does not have authentication. The response status should be 401.
  • Sixteenth test posts platform with same keyword user before to same user. The response status should be 409. The request does not allow same user to post same platform again.

Example Responses

image image image image image image image image image image image image

Challenges

I have not dealt backend and frontend until the project. Therefore learning Node and React took my time much. However this enabled mu gain many experiences. Learning causes most of us to start project late. However I believe we have sufficient project.

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