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_valueEVERY time ANYteamtypes performs ANYactions.
Valid type formats identified thus far:
"EVERY_ANY_ANY"
Award the value for every time any team performed any of the actions.
Example: "-7 each if any team performed any action
"EVERY_EVERY_EVERY"
Award the value for every time every team performed every action.
Functionally equivalent to "ANY_EVERY_EVERY".
Example: "-7 if all teams performed all actions."
"EVERY_ANY_EVERY"
Award the value for every time any team performs every action.
Example: "-5 each if any team did every actions x,y, and z."
"EVERY_EVERY_ANY"
Award the value for every time every team performs any action.
Example: "-3 each if every team did any actions x,y, or z."
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.
Fixes #37.
Description
This pull request adds a model, controller,
GET
API routes, and seed data for Mitigations.Includes the following changes/additions:
GET
routes for retrieving mitigations from the API.apidocs
documentation for the newGET
routes.event
andteamtype
now have explicitly definedid
fields. This is necessary to ensure proper FK relation formitigation
seed data.data
field now has a formal standard, same with thetype
field..github/
directory with aPULL REQUEST TEMPLATE
for creating pull requests with useful details.knex.js
has commented out lines of code for easily switching between Postgres and Sqlite3 in thedevelopment
configuration.Example Requests
Note: Append each route with the
withRelated=event
query param to include the associatedevent
model in the response data.GET /api/mitigation
event_id
.GET /api/mitigation?event_id=[ID]
id
.GET /api/mitigation/:id
Example Response (200)
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: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