Skip to content

Individual Contribution Section Çisel Zümbül

cisel-zumbul edited this page May 12, 2023 · 10 revisions

Contributions

Week 7 (13.04.23 - 19.04.23 Mostly Spring Break)
    Description Type of Work Issue Time Spent
    Attending Weekly Team Meeting #7 Discussion - 1 hour 30 mins
    Learning How To Use Git Effectively Research #124 4 hours
Week 8 (20.04.23 - 26.04.23)
    Description Type of Work Issue Time Spent
    Research about NodeJS and Learning The Basics Research #123 5 hours
    Research about Docker and Looking For Some Fundamental Commands Research #125 1 hours 30 mins
    Searching For API Candidates to Use In Our Practice App Research #126 4 hours
Week 9 (27.04.23 - 03.05.23)
    Description Type of Work Issue Time Spent
    Attending and Note Taking Weekly Team Meeting #8 Discussion - 2 hours
Week 10 (04.05.23 - 10.05.23)
    Description Type of Work Issue Time Spent
    Adding The Notes Of Weekly Team Meeting #8 Discussion #156 1 hour
    Moderating Weekly Team Meeting #9 Discussion - 1 hour 45 mins
    Implementing a Post Endpoint for Practice App Feature #193 5 hours
    Creating the Schema of MongoDb GameReview Collection for Practice App Feature #191 2 hours
Week 11 (11.05.23 - 17.05.23)
    Description Type of Work Issue Time Spent
    Attending Weekly Team Meeting #10 Discussion - 1 hour 30 mins
    Implementing a Get Endpoint for Practice App Feature #237 4 hours
    Creating Game Reviews Frontend Page for Practice App Feature #242 1 hour
    Writing Unit Tests For Game Review Endpoints Test #252 2 hours
    Research about Swagger Research #125 1 hour 30 mins
    Creating a Documentation Page for Game Reviews API Documentation #288 2 hours
    Preparing "Overall Status" Part of the Milestone Report Documentation #321 2 hours
    Creating Individual Contribution Section for Milestone Report Documentation #322 4 hours

Third Party APIs

OpenCritic is a website that compiles reviews of video games from various online publications and calculates an average score based on these review scores. For the practice app, I'm utilizing two different endpoints from the OpenCritic API. The purpose of my page is to display a few reviews to users about the game they have searched for.

Utilized endpoints

GET: Game Search

Searches OpenCritic for games with similar names or titles.
route: https://opencritic-api.p.rapidapi.com/games/search

GET: Reviews For Game

Gets reviews for a game with a specific Game ID.
route: https://opencritic-api.p.rapidapi.com/reviews/game/{gameid}

For a detailed documentation, you can check here.

Created API Functions

POST: Insert Game Reviews

Allows users to search for the top three reviews for a game of their choice from OpenCritic's database of game reviews. Users can input the name of the game in the request body, and the endpoint will issue a request to the Game Search endpoint of the OpenCritic API to obtain the unique ID of the game. Subsequently, the endpoint queries the Game Reviews endpoint using the obtained ID to retrieve the top three reviews for the game. The reviews are then stored in the database together with the user's email address provided in the request body.
route: api/v1/games/review

GET: Get Game Reviews By Email

Allows users to access a chronologically ordered list of the reviews they have previously searched. Accomplishes that by querying the database with the user's email address, which is provided in the request as a query parameter
route: api/v1/games/review

For a detailed documentation, visit this page.

Unit Tests

For the unit tests JEST framework is used. Regarding the use of JEST framework for unit tests, it is worth noting that this approach allows for a more robust and comprehensive testing process. By implementing various tests, covering each possible scenario, we can ensure that the code is functioning as expected under different conditions and inputs.

POST /review

These tests are responsible for ensuring that the API endpoint POST /api/v1/games/review works correctly when valid data is provided in the request body. It should return a HTTP status code of 201 stating some database objects are created and a success message if all necessary fields are provided.

Test Cases:

  • Case 1: When correct data is provided, it should return status code 201 and a success message
   test("should respond with status code 201 and a success message in json with correct data  ", async function () {
    const response = await request(app).post(url).send(correctPostData);
    expect(response.status).toEqual(201);
    expect(response.headers["content-type"]).toMatch(/json/);
    expect(response.body.status).toEqual("success");
    expect(response.body.message).toEqual(
      "Game reviews for the game Human: Fall Flat are inserted to the database successfully"
    );
  });
  • Case 2: When email field is missing, it should return status code 400 and an error message stating that all necessary fields should be provided.
   {
    test("should respond with status code 400 and a error message in json with missing email", async function () {
    const response = await request(app).post(url).send(missingEmailData);
    expect(response.status).toEqual(400);
    expect(response.headers["content-type"]).toMatch(/json/);
    expect(response.body.status).toEqual("Error");
    expect(response.body.message).toEqual(
      "You should provide all the necessary fields"
    );
  });
   }
  • Case 3: When game name field is missing, it should return status code 400 and an error message stating that all necessary fields should be provided.
    test("should respond with status code 400 and a error message in json with missing email", async function () {
    const response = await request(app).post(url).send(missingEmailData);
    expect(response.status).toEqual(400);
    expect(response.headers["content-type"]).toMatch(/json/);
    expect(response.body.status).toEqual("Error");
    expect(response.body.message).toEqual(
      "You should provide all the necessary fields"
    );
  });
  • Case 4: When sort option is provided, it should still return status code 201 and a success message.
    test("should respond with status code 400 and a error message in json with missing game name", async function () {
    const response = await request(app).post(url).send(missingGameNameData);
    expect(response.status).toEqual(400);
    expect(response.headers["content-type"]).toMatch(/json/);
    expect(response.body.status).toEqual("Error");
    expect(response.body.message).toEqual(
      "You should provide all the necessary fields"
    );
  });
  

GET /review

These test are responsible for ensuring that the API endpoint GET /api/v1/games/review works correctly when valid data is provided in the query parameter. It should return a HTTP status code of 200 and game reviews from the database if a registered user's email address is provided, otherwise it should return a not found error message. To be able to test the GET endpoint, first some seed data is created, upon completion of the tests this data is removed in order not to leave dirty data in the database.

Test Cases:

  • Case 1: When a registered user's email is provided, it should return status code 200 and all game reviews associated with that user's email address.
 test("should respond with status code 200 and a success message in json with correct data  ", async function () {
    const response = await request(app).get(registeredUserUrl);
    expect(response.status).toEqual(200);
    expect(response.headers["content-type"]).toMatch(/json/);
    expect(response.body.length).toEqual(2);
    expect(response.body[0].user_email).toBeDefined();
    expect(response.body[1].user_email).toBeDefined();
    expect(response.body[0].game_id).toBeDefined();
    ...
    ...
    ...
  });
  • Case 2: When a non-registered user's email is provided, it should return status code 404 and a not found error message.
    test("should return a not found error with a non registered user email ", async function () {
    const response = await request(app).get(nonRegisteredUserUrl);
    expect(response.status).toEqual(404);
    expect(response.headers["content-type"]).toMatch(/json/);
    expect(response.body.message).toEqual("There is no game that you've searched for its reviews before");
  });

Sample Calls

Sample Call to OpenCritic API GET .../games/search

  • Request
 {
  method: 'GET',
  url: 'https://opencritic-api.p.rapidapi.com/game/search',
  params: {
    criteria: 'the withcer 3'
  },
  headers: {
    'X-RapidAPI-Key': "apikey",
    'X-RapidAPI-Host': 'opencritic-api.p.rapidapi.com'
  }
}
  • Response
 {
  [
  {
    "id": 463,
    "name": "The Witcher 3: Wild Hunt",
    "dist": 0.615385
  },
  {
    "id": 1557,
    "name": "The Witness",
    "dist": 0.631579
  },
  {
    "id": 13938,
    "name": "The Past Within",
    "dist": 0.636364
  },
  {
    "id": 188,
    "name": "The Evil Within",
    "dist": 0.636364
  },
  {
    "id": 11681,
    "name": "Within the Blade",
    "dist": 0.652174
  },
  {
    "id": 4502,
    "name": "The Evil Within 2",
    "dist": 0.666667
  },
  {
    "id": 6430,
    "name": "The Walker",
    "dist": 0.684211
  },
  {
    "id": 5147,
    "name": "Maria the Witch",
    "dist": 0.695652
  },
  {
    "id": 5701,
    "name": "The Wizards",
    "dist": 0.7
  },
  {
    "id": 13244,
    "name": "The Guild 3",
    "dist": 0.7
  }
]

Sample Call to OpenCritic API GET .../games/review

  • Response
{
  method: 'GET',
  url: 'https://opencritic-api.p.rapidapi.com/reviews/game/463',
  params: {sort: 'blend'},
  headers: {
    'X-RapidAPI-Key': 'apikey',
    'X-RapidAPI-Host': 'opencritic-api.p.rapidapi.com'
  }
}
  • Response
    • Returns 20 review object but here only two is shown.
[
  {
    "_id": "5d866f6d93765d6778740c57",
    "magic": 5600,
    "isChosen": true,
    "title": null,
    "publishedDate": "2015-05-21T04:00:00.000Z",
    "externalUrl": "http://www.pcgamer.com/the-witcher-3-review/",
    "snippet": "A big, beautiful, sprawling action RPG full of rich stories, and suffused with an oppressive darkness.",
    "language": "en-us",
    "score": 92,
    "npScore": 100,
    "isQuoteManual": null,
    "Authors": [
      {
        "_id": "5d866f6d93765d6778740c58",
        "id": 732,
        "name": "Shaun Prescott",
        "image": false
      }
    ],
    "ScoreFormat": {
      "id": 17,
      "name": "0 to 100, whole numbers",
      "shortName": "x / 100",
      "scoreDisplay": " / 100",
      "isNumeric": true,
      "isSelect": false,
      "isStars": false,
      "numDecimals": 0,
      "base": 1,
      "options": null
    },
    "Platforms": [
      {
        "_id": "5d866f6d93765d6778740c59",
        "id": 27,
        "name": "PC",
        "shortName": "PC"
      }
    ],
    "alias": "Shaun Prescott",
    "game": {
      "id": 463,
      "name": "The Witcher 3: Wild Hunt"
    },
    "Outlet": {
      "name": "PC Gamer",
      "isContributor": false,
      "id": 162,
      "imageSrc": {
        "og": "outlet/162/o/FpKaL1Hj.jpg",
        "sm": "outlet/162/Tzt3P7so.jpg",
        "lg": "outlet/162/LQgtWlmu.jpg"
      }
    },
    "createdAt": "2019-09-21T18:43:57.510Z",
    "updatedAt": "2022-08-11T16:47:27.325Z",
    "__v": 0,
    "blend_magic": 5600
  },
  {
    "_id": "5d866f6c93765d6778740bdc",
    "magic": 5600,
    "isChosen": true,
    "title": null,
    "publishedDate": "2015-05-12T04:00:00.000Z",
    "externalUrl": "http://www.ign.com/articles/2015/05/12/the-witcher-3-the-wild-hunt-review",
    "snippet": "Massive in size, and meticulously detailed, The Witcher 3 ends Geralt's story on a high note.",
    "language": "en-us",
    "score": 93,
    "npScore": 100,
    "isQuoteManual": null,
    "Authors": [
      {
        "_id": "5d866f6c93765d6778740bdd",
        "id": 196,
        "name": "Vince Ingenito",
        "image": false
      }
    ],
    "ScoreFormat": {
      "id": 18,
      "name": "0 to 10 incl decimals",
      "shortName": "x.x / 10.0",
      "scoreDisplay": " / 10.0",
      "isNumeric": true,
      "isSelect": false,
      "isStars": false,
      "numDecimals": 1,
      "base": 10,
      "options": null
    },
    "Platforms": [
      {
        "_id": "5d866f6c93765d6778740be0",
        "id": 6,
        "name": "PlayStation 4",
        "shortName": "PS4"
      },
      {
        "_id": "5d866f6c93765d6778740bdf",
        "id": 7,
        "name": "Xbox One",
        "shortName": "XB1"
      },
      {
        "_id": "5d866f6c93765d6778740bde",
        "id": 27,
        "name": "PC",
        "shortName": "PC"
      }
    ],
    "alias": "Vince Ingenito",
    "game": {
      "id": 463,
      "name": "The Witcher 3: Wild Hunt"
    },
    "Outlet": {
      "name": "IGN",
      "isContributor": false,
      "id": 56,
      "imageSrc": {
        "og": "outlet/56/o/ljTZSOGp.jpg",
        "sm": "outlet/56/1v75XFcW.jpg",
        "lg": "outlet/56/AmLzvUhj.jpg"
      }
    },
    "createdAt": "2019-09-21T18:43:56.011Z",
    "updatedAt": "2022-08-11T16:47:21.953Z",
    "__v": 0,
    "blend_magic": 5600
  }
]

Sample Call Implemented API Function POST .../api/v1/games/review

  • Request
   {
    "userEmail": "[email protected]",
    "gameNameCriteria": "We were here together"
   }
  • Response
   {
    "status": "success",
    "message": "Game reviews for the game We Were Here Together are inserted to the database successfully"
   }

Sample Call Implemented API Function GET .../api/v1/games/review?userEmail=[email protected]

  • Response
   [
    {
        "_id": "645e89755404d4b5fb64e316",
        "user_email": "[email protected]",
        "game_name": "We Were Here Together",
        "game_id": 8600,
        "reviews": [
            {
                "review_text": "We Were Here Together is ultimately a bit of a let down on console. Some of the biggest puzzles are quite frustrating, some of the others rely on a poorly designed user interface, and the ones we most enjoyed were the shorter ones anyway. There are better coop puzzlers to spend your cash, time, and friendships on.",
                "publish_date": "2021-02-23T00:00:00.000Z",
                "_id": "645e89755404d4b5fb64e317"
            },
            {
                "review_text": "We Were Here Together is a \"escape room\" type of videogame, exclusively for two players online. Communication through voice chat is essential to solve the puzzles, but some of them are not very intuitive and the story is weak. If you've got someone to play with (and a bit of patience) you'll have a very unique experience.",
                "publish_date": "2021-02-22T00:00:00.000Z",
                "_id": "645e89755404d4b5fb64e318"
            },
            {
                "review_text": "We Were Here Together is a fun escape the room type of puzzle game with an interesting story and beautiful aesthetic and soundtrack. It's let down by some unnecessary difficulty and teething console issues with regards to controls.",
                "publish_date": "2020-06-04T00:00:00.000Z",
                "_id": "645e89755404d4b5fb64e319"
            }
        ],
        "createdAt": "2023-05-12T18:46:13.632Z",
        "updatedAt": "2023-05-12T18:46:13.632Z",
        "__v": 0
    },
    {
        "_id": "645822de18f58fece9cb3950",
        "user_email": "[email protected]",
        "game_name": "Human: Fall Flat",
        "game_id": 2906,
        "reviews": [
            {
                "review_text": "Human: Fall Flat’s slapstick controls and ridiculous animation do a great job of making repeated, frustrating, and unfair failure at physics puzzles seem fun for a while. And when that fun runs out, you can extend it by bringing in a friend and drawing silly things on your goofball character. If you don’t play it, watch someone play it.",
                "publish_date": "2016-07-28T04:00:00.000Z",
                "_id": "645822de18f58fece9cb3951"
            },
            {
                "review_text": "An abrupt ending that doesn't have much of a climax and some moments of fist-clenching frustration keep Human: Fall Flat from the upper echelons of puzzle gaming, but it's still something I plan on going back to with friends. Plus, it lets you draw on your character, leading to the butt you see in all of the screenshots. Apparently, I wasn't the only one who thought this was hilarious. This one was for you, Laura!",
                "publish_date": "2016-08-06T04:00:00.000Z",
                "_id": "645822de18f58fece9cb3952"
            },
            {
                "review_text": "Human Fall Flat is a game that’s aware of how unusual it is and builds to its own strengths. Bob’s ungainly controls work particularly well in the invitingly designed worlds that let you play around, cheat and conspire with a co-op buddy.",
                "publish_date": "2016-07-27T04:00:00.000Z",
                "_id": "645822de18f58fece9cb3953"
            }
        ],
        "createdAt": "2023-05-07T22:14:54.465Z",
        "updatedAt": "2023-05-07T22:14:54.465Z",
        "__v": 0
    }
]

Challenges

In this project, I've encountered some challenges. Firstly, I wasn't familiar enough the Node.js and the JEST testing framework. I also haven't used non relational database before. Funny thing, we've chosen all of these technologies to implement things easily, however considering the time spent to get to learn them, maybe they weren't the best choices after all. Secondly, we had hard time in understanding the description of the project, we couldn't come to a mutual understanding for a long time, ended up having a lot of long meetings to make sure we were on the same page and this kept us from even starting to the project. Due to this delays, we had to do everything almost at the last moment and it was very stressful. To address these challenges in future projects, it would be important to carefully evaluate the technology choices considering the team's expertise and project requirements. Additionally, we shouldn't hesitate to ask many questions to ensure everyone understands the project objectives and timeline, which can help avoid delays and prevent a last-minute rush to complete the project.



💻 Meeting Notes

Cmpe 352
Cmpe 451

📝 Requirements


🪧 Diagrams


📬 Deliverables

Cmpe 352
Cmpe 451

🎇 General Contributions

Cmpe 352 Contributions

Milestone 1
Final Milestone

Cmpe 451 Contributions

Milestone 1
Milestone 2
Final Milestone

📕 Mock Up


🕵️ User Scenario



📝 RAM


📚 Research


📑 Templates


📱 Practice App

API Documentation for Practice App
Clone this wiki locally