Creates new rating or updates existing one.
Parameter | Type |
---|---|
userId | ObjectId |
gameId | ObjectId |
rating | int |
{
"userId": "6230d1efc7cf775edc5edd2d",
"gameId": "6221f7b42c5227347bac7594",
"rating": 1
}
- Success -
Code: 200
{
"message": "Rating updated."
}
- Failure -
Code: 400
{
"error": "Game not found."
}
Returns the rating given by the user for a given game.
Parameter | Type |
---|---|
userId | ObjectId |
gameId | ObjectId |
{
"userId": "6230d1efc7cf775edc5edd2d",
"gameId": "6221f7b42c5227347bac7594",
}
- Success -
Code: 200
{
"rating": 1
}
- Failure -
Code: 400
{
"error": "User not found."
}
Returns how many people liked / disliked the game.
Parameter | Type |
---|---|
gameId | ObjectId |
{
"gameId": "6221f7b42c5227347bac7594"
}
- Success -
Code: 200
{
"likes": 192,
"dislikes": 37
}
- Failure -
Code: 400
{
"likes": 0,
"dislikes": 0
}