You are an Actifai backend engineer managing a database of our users - who are call center agents - and the sales that the users place using our application.
The database has 4 tables:
users: who are the users (name, role)groups: groups of usersuser_groups: which users belong to which groupssales: who made a sale, for how much, and when was it made
The front-end team has decided to build an analytics and reporting dashboard to display information about performance to our users. They are interested in tracking which users and groups are performing well (in terms of their sales). The primary metric they have specified as a requirement is average revenue and total revenue by user and group, for a given month.
Your job is to build the API that will deliver data to this dashboard. In addition to the stated requirements above, we would like to see you think about what additional data/metrics would be useful to add.
At a minimum, write one endpoint that returns time series data for user sales i.e. a list of rows, where each row corresponds to a time window and information about sales. When you design the endpoint, think about what query parameters and options you want to support, to allow flexibility for the front-end team.
This repository contains a bare-bones Node/Express server, which is defined in server.js. This file is where you will
define your endpoints.
- Install Docker (if you don't already have it)
- Run
npm ito install dependencies - Run
docker-compose upto compile and run the images. - You now have a database and server running on your machine. You can test it by navigating to
http://localhost:3000/healthin your browser. You should see a "Hello World" message.
If you have any questions, feel free to reach out to your interview scheduler for clarification!