Register
Submit a solution
The challenge is finished.

Challenge Overview

Cloud Hub has created a couple challenges to build our reporting endpoints. We want to build another endpoint to return the number of applications and spend each month for the last year. This will require that we send the app count to elasticsearch, just as we are doing for the spending each month.

Requirements
1. Add to jobService.spendAll an activity to send the number of active (status === A) apps for each company. (sample data below)
2. Check for existing data before indexing the same event. Right now running spendAll will keep adding new events. This service should delete and recreate the documents.
3. Build new endpoint /companies/{companyId}/reporting/history which will return the app count and spending each month for the last 12 months. (sample data below)
4. Create swagger endpoints for each /companies/{companyId}/reporting/{type}, instead of the 1 endpoint today. After this challenge there should be 3 listed: renewals, history and categories.
5. Create tests for all reporting endpoints, categories has some of this started.

sample data for app count activity
 {
     "_type": "activities",
     "_source": {
         "activityType": "app-count",
         "structure": [{
             "text": "June",
             "textType": "month"
         }],
         "timestamp": "{{current date}}",
         "amount": 0
        "count": {{app count}}
     }
 }

sample data for reporting endpoint
[{
    "month": "May",
    "apps": "1",
    "spend": 15000
}, {
    "month": "June",
    "apps": "2",
    "spend": 15000
}]

Final Submission Guidelines

1. Any additions or modifications to the code project pass on "npm run lint" and "npm run test".
2. Provide your code and documentation in a single zip file. Please include a git patch for easier integration of changes.
3. The bulk of your documentation should be in the Readme.md and you should assume that this will be open source so make sure you cover all the steps to set up,  If you have specific information that should not be included in a public readme (like links to your video) put them in a file called submission.txt and they will be omitted from the project if it is open sourced.
4. Provide a quick video of your solution in action (feel free to annotate your video if you are not comfortable with spoken English or don’t like the sound of your own voice). Video may be private on youtube or added to the submission files. Your video can skip the setup of your environment, linting and tests. We are interested to see the new functionality of the app in the video.

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30054875