Hello there,
so you want to be developer in U+? We prepared a little challenge for you. No bullshit, just a real world scenario, you could face as dev here.
We love to play our Playstation in office, one of the game here is GTA V. But we would like to buy older games from this series. And of course as cheap as possible. You will be Backend developer providing API endpoint for your colleague on frond-end checking if game is cheap enough to buy.
Your tech stack will be Nest.js which is wrapper around Node.js + Express taking advantage of Typescript. If you don't know it, check it out, its really easy to start, check https://docs.nestjs.com/
.
You will work with API https://www.cheapshark.com/api/
. Lucky for you somebody just started on this project, so continue, where he left. Fork this repo and:
- Expand app logic to fetch the cheapest price ever for game (spoiler alert - you need to call
https://www.cheapshark.com/api/documentation.html#deals
). - Return just data in
IGame
interface to endpoint GET/games
. - When endpoint GET
/games
is called, you have to save this event to database (of your choice). You will save just when endpoint was called. In the end you will have in table two columnsid
andcalled_at
of type DATETIME. - Make endpoint GET
/calls
and return data from database you created. Return only calls made on Mondays. - Endpoint GET
/calls
has to be private, make it so, it's up to you what method will you choose. - Tests are up to you, if you will provide them, you will get in front of other candidates.
Copy .env.example
to file .env
$ npm install
$ npm start
- Tests are not done - I did not fully get my head around the NestJS module testing and it seems that using Call service as a part of game module is somehow interfering with creating a test instance of modules since.
- so Far I've spend 5 hours on the project
- got stuck for an hour and half on searching for suitable redis client for given project setup.
- I'll have more time to work on the project tomorrow but for now this is all I have. I do not consider this a fullfilled task yet so please do not evaluate this as a final thing. Take it more like a possibility for first feedback.
- I did not use the usual dev_secret and app_secret combination for private api because it does not make the implementation more interesting in any particular way. It would be just one more writing and reading from DB. We already have that covered in the
calls
endpoint itself. That's why I have decided to use the golden key approach.