We need an endpoint, something like POST /games/collection, which takes an external game ID and platform ID and adds it to the collection. This is going to require creating a database which will allow us to persist the data.
Also, this may be a bit weird but I have this idea of separating the game data and the collection into separate models. A games table should contain:
id
external_id
external_url - Link to IGDB
title
description
image - URL to an image in IGDB - let's just hotlink images for now
Then we have a collection table which just contains a list of the game IDs that are in the collection. Let's make everything work with a single collection across the entire app for now and then add in user accounts later.
The endpoint should return a 201 response if the game was added to the collection and a 200 response if the game already exists. The response body should be the game data of the added game.
We need an endpoint, something like
POST /games/collection
, which takes an external game ID and platform ID and adds it to the collection. This is going to require creating a database which will allow us to persist the data.Also, this may be a bit weird but I have this idea of separating the game data and the collection into separate models. A
games
table should contain:id
external_id
external_url
- Link to IGDBtitle
description
image
- URL to an image in IGDB - let's just hotlink images for nowThen we have a
collection
table which just contains a list of the game IDs that are in the collection. Let's make everything work with a single collection across the entire app for now and then add in user accounts later.The endpoint should return a
201
response if the game was added to the collection and a200
response if the game already exists. The response body should be the game data of the added game.