Giter VIP home page Giter VIP logo

samar-test's Introduction

Seat allocation App

How to setup application

Pre-resituate

node > v16.* yarn install (optionally, preferred)

Steps

1- cmd yarn or npm install 2- set PORT, DB other in .env file 3- cmd for

  • dev: yarn start:dev or npm run start:dev
  • prod: yarn start or npm run start 4- cmd for running test
  • yarn test

DB schema refer

  • read db-schema.md file

How app is working

  • Find nearby routes with in specific distance like 400 meters by user current location API: GET /routes?latitude=70.4977&longitude=25.3767&limit=2
  • Once user get routes then he/she able to get trips of that route by route id with vehicle info API: GET /trips/123
  • Once user select trip, we return only booked seats API: GET /bookings/available-seats/123
  • Final user can select only available seats(which are not in previous call) API: POST /bookings

How to check seat availability

Each vehicles have totalSeats like 16 of vehicle A. On booking creation time we only store user selected seat. Eg User X, select seat 10 & 11. We store only two seats in booking table. All seats that are not in booking table are free.

Improvements in task

  • App must be dockerize
  • Use ORM for DB connectivity like typeorm/prisma/knex/Sequelize/
  • Setup eslint & prettier
  • Use any logger library like winston/pino for logging and debugging on prod

My Suggestions

Product level

  • User should be able to access via phone_number instead of username, we can easily verify user
  • User should not be able to see other booked seat user information

Tech level

  • We should use any good nodejs framework or boilerplate, which have built-in app structure, DB connectivity, Logging, Session, Validation, Caching etc so we don't need to setup from scratch
  • Each service must be dockerize
  • Use typescript instead of javascript because it helps use to prevent prod issues

samar-test's People

Contributors

samar-cassbana avatar

Watchers

Syed Samar Haider Rizvi 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.