andymeneely / dev-fortress-server

MIT License
4 stars 0 forks source link

Add Mitigation model with GET routes #62

Closed ShaydeNofziger closed 7 years ago

ShaydeNofziger commented 7 years ago

Fixes #37.

Description

This pull request adds a model, controller, GET API routes, and seed data for Mitigations.

Includes the following changes/additions:

Example Requests

Note: Append each route with the withRelated=event query param to include the associated event model in the response data.

Example Response (200)

{
  "id": 1,
  "type": "EVERY_ANY_ANY",
  "data": {
    "teamtypes": [1,2,3,4],
    "actions": [30],
    "reward_value": 3
  },
  "event_id": 1
}

Note: type is composed of 3 words that represent how the mitigation reward should be calculated by the system. It should be read as follows:

Give reward_value EVERY time ANY teamtypes performs ANY actions.

Valid type formats identified thus far:

Known Issues

This does not cover all of the seed data for mitigations. The basic "EVERY_ANY_ANY" cases were included, but additional work will need to be done to add in the remaining seeded/default mitigations.

Code coverage for /app/controllers/mitigation.js

Before After
N/A 100%