Task is to build a small user management service.

  1. Routes to implement:
    1. GET /users?id={userId}&phoneNumber={phoneNumber}
      • fetch a user matching the query
      • if no query params are specified, return all
    2. POST /users (create a user)
    3. PATCH /users?id={userId}&phoneNumber={phoneNumber}
      • Bulk update users
      • Query parameters should work exactly like they do in GET
    4. DELETE /users?id={userId}&phoneNumber={phoneNumber}
      • Bulk delete users
    5. Note: the the exact implementation (contains, equals, prefix) is up to you. Feel free to add more query parameters you feel would be important
    6. Note: You have to implement any relevant models to implement the service. You must add the migrations as well
    7. Note: Ensure you do request validation. Bonus points for response validation too
  2. Constraints:
    1. Use NodeJS + Typescript
    2. You must use the serverless framework
    3. Use TypeORM as the ORM (be sure to generate and include the migrations)
    4. Use any SQL based database (including sqlite, this is just a test service)
    5. An OpenAPI document documenting the service must be present. Preferably, write the document first and generate the models/routes from there
    6. Use OpenAPI-Backend (https://www.npmjs.com/package/openapi-backend) to auto generate the server, it’s request validation etc.
      1. OpenAPI Backend must be served over serverless-offline
      2. Serverless is hard to test with, use OpenAPI Backend over express to run tests
  3. Automated unit tests:
    1. Testing is fundamental to the backend
    2. Test whether your code actually returns the expected output and only modifies/updates the expected items
    3. Test whether request validation is happening correctly
    4. Tests must be written using Jest
    5. Routes must be tested using supertest
  4. You will be judged on the following:
  1. Upon completion. Create a repo on GitHub and send the url to the repo.