Coder Social home page Coder Social logo

arda-dreamland's Introduction

Arda Dreamland

My solution to Arda's "Dreamland" code assignment for a job application as software engineer.

Steps taken

  • Bootstrapped initial project structure with Fastify-CLI
  • Added 4 Endpoints with schema's for validation:
    • POST /tokens : user has won some amount of DREAM token at a particular time of a day (can be fractional tokens)
    • GET /tokens?user_id={user_id} : returns the history of tokens a user has won for the current day so far _ GET /usd?user_id={user_id} : returns the history of USD amounts a user has won till now (since start of current day)
    • GET /stats?user_id={user_id} : returns the stats: sum of tokens won on the current day so far and the total value of USD a user has in his account
  • Replaced TAP with Jest and added some API tests (failing first to spec the API endpoints and responses)
  • Added TypeORM using Fastify-TypeORM plugin, with data models for users, tokens and usd ledgers (using auto sync without migrations)
  • Implemented logic for API endpoints & fixed tests with mocked database
  • Fixed issue with TypeORM entities and auto-sync (moved all stats into one Accounts entity for simplicity)
  • Added Decimal.js to fix rounding issues with floating point numbers

Available Scripts

In the project directory, you can run:

npm run dev

To start the app in dev mode.
Open http://localhost:3000 to view it in the browser.

npm start

For production mode

npm run test

Run the test cases.

arda-dreamland's People

Contributors

robvenn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.