Commit f6ebb02a48a6ba8188a31bbedf76b2ea0d756238

Authored by kristinlaahneolsen
1 parent c825c8d5

Laget rute for å se vurdering basert på id, alle vurderinger og legge til en vurdering

Showing 2 changed files with 221 additions and 90 deletions   Show diff stats
restApi/.idea/workspace.xml
... ... @@ -2,13 +2,8 @@
2 2 <project version="4">
3 3 <component name="ChangeListManager">
4 4 <list default="true" id="8a337026-05ab-47b0-872d-ab1e8037e9a0" name="Default" comment="">
5   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../Risiko/.idea/misc.xml" afterPath="$PROJECT_DIR$/../Risiko/.idea/misc.xml" />
6   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/restApi.iml" afterPath="$PROJECT_DIR$/.idea/restApi.iml" />
7   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
8   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/routes/routes.js" afterPath="$PROJECT_DIR$/api/routes/routes.js" />
9   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/package-lock.json" afterPath="$PROJECT_DIR$/package-lock.json" />
10   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/package.json" afterPath="$PROJECT_DIR$/package.json" />
11   - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/server.js" afterPath="$PROJECT_DIR$/server.js" />
  5 + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
  6 + <change beforePath="$PROJECT_DIR$/api/routes/routes.js" afterPath="$PROJECT_DIR$/api/routes/routes.js" />
12 7 </list>
13 8 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
14 9 <option name="TRACKING_ENABLED" value="true" />
... ... @@ -20,7 +15,6 @@
20 15 <component name="CreatePatchCommitExecutor">
21 16 <option name="PATCH_PATH" value="" />
22 17 </component>
23   - <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
24 18 <component name="FUSProjectUsageTrigger">
25 19 <session id="920369055">
26 20 <usages-collector id="statistics.lifecycle.project">
... ... @@ -61,8 +55,8 @@
61 55 <file leaf-file-name="routes.js" pinned="false" current-in-tab="true">
62 56 <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
63 57 <provider selected="true" editor-type-id="text-editor">
64   - <state relative-caret-position="420">
65   - <caret line="115" column="47" lean-forward="false" selection-start-line="115" selection-start-column="47" selection-end-line="115" selection-end-column="47" />
  58 + <state relative-caret-position="481">
  59 + <caret line="211" column="37" lean-forward="true" selection-start-line="211" selection-start-column="37" selection-end-line="211" selection-end-column="42" />
66 60 <folding />
67 61 </state>
68 62 </provider>
... ... @@ -88,6 +82,16 @@
88 82 </provider>
89 83 </entry>
90 84 </file>
  85 + <file leaf-file-name="package-lock.json" pinned="false" current-in-tab="false">
  86 + <entry file="file://$PROJECT_DIR$/package-lock.json">
  87 + <provider selected="true" editor-type-id="text-editor">
  88 + <state relative-caret-position="0">
  89 + <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
  90 + <folding />
  91 + </state>
  92 + </provider>
  93 + </entry>
  94 + </file>
91 95 <file leaf-file-name="package.json" pinned="false" current-in-tab="false">
92 96 <entry file="file://$PROJECT_DIR$/package.json">
93 97 <provider selected="true" editor-type-id="text-editor">
... ... @@ -121,8 +125,8 @@
121 125 <file leaf-file-name="evaluation.js" pinned="false" current-in-tab="false">
122 126 <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
123 127 <provider selected="true" editor-type-id="text-editor">
124   - <state relative-caret-position="150">
125   - <caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
  128 + <state relative-caret-position="30">
  129 + <caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="19" />
126 130 <folding />
127 131 </state>
128 132 </provider>
... ... @@ -191,10 +195,11 @@
191 195 </packageJsonPaths>
192 196 </component>
193 197 <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
194   - <component name="ProjectFrameBounds">
195   - <option name="y" value="23" />
196   - <option name="width" value="1440" />
197   - <option name="height" value="873" />
  198 + <component name="ProjectFrameBounds" fullScreen="true">
  199 + <option name="x" value="1440" />
  200 + <option name="y" value="-180" />
  201 + <option name="width" value="1920" />
  202 + <option name="height" value="1080" />
198 203 </component>
199 204 <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
200 205 <component name="ProjectView">
... ... @@ -212,54 +217,36 @@
212 217 <foldersAlwaysOnTop value="true" />
213 218 </navigator>
214 219 <panes>
215   - <pane id="Scope" />
  220 + <pane id="Scratches" />
216 221 <pane id="ProjectPane">
217 222 <subPane>
218   - <PATH>
219   - <PATH_ELEMENT>
220   - <option name="myItemId" value="restApi" />
221   - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
222   - </PATH_ELEMENT>
223   - <PATH_ELEMENT>
224   - <option name="myItemId" value="restApi" />
225   - <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
226   - </PATH_ELEMENT>
227   - </PATH>
228   - <PATH>
229   - <PATH_ELEMENT>
230   - <option name="myItemId" value="restApi" />
231   - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
232   - </PATH_ELEMENT>
233   - <PATH_ELEMENT>
234   - <option name="myItemId" value="restApi" />
235   - <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
236   - </PATH_ELEMENT>
237   - <PATH_ELEMENT>
238   - <option name="myItemId" value="api" />
239   - <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
240   - </PATH_ELEMENT>
241   - <PATH_ELEMENT>
242   - <option name="myItemId" value="routes" />
243   - <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
244   - </PATH_ELEMENT>
245   - </PATH>
246   - <PATH>
247   - <PATH_ELEMENT>
248   - <option name="myItemId" value="restApi" />
249   - <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
250   - </PATH_ELEMENT>
251   - <PATH_ELEMENT>
252   - <option name="myItemId" value="restApi" />
253   - <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
254   - </PATH_ELEMENT>
255   - <PATH_ELEMENT>
256   - <option name="myItemId" value="api" />
257   - <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
258   - </PATH_ELEMENT>
259   - </PATH>
  223 + <expand>
  224 + <path>
  225 + <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
  226 + <item name="restApi" type="462c0819:PsiDirectoryNode" />
  227 + </path>
  228 + <path>
  229 + <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
  230 + <item name="restApi" type="462c0819:PsiDirectoryNode" />
  231 + <item name="api" type="462c0819:PsiDirectoryNode" />
  232 + </path>
  233 + <path>
  234 + <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
  235 + <item name="restApi" type="462c0819:PsiDirectoryNode" />
  236 + <item name="api" type="462c0819:PsiDirectoryNode" />
  237 + <item name="modules" type="462c0819:PsiDirectoryNode" />
  238 + </path>
  239 + <path>
  240 + <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
  241 + <item name="restApi" type="462c0819:PsiDirectoryNode" />
  242 + <item name="api" type="462c0819:PsiDirectoryNode" />
  243 + <item name="routes" type="462c0819:PsiDirectoryNode" />
  244 + </path>
  245 + </expand>
  246 + <select />
260 247 </subPane>
261 248 </pane>
262   - <pane id="Scratches" />
  249 + <pane id="Scope" />
263 250 </panes>
264 251 </component>
265 252 <component name="PropertiesComponent">
... ... @@ -303,39 +290,41 @@
303 290 <workItem from="1538838941552" duration="10339000" />
304 291 <workItem from="1538928470276" duration="5791000" />
305 292 <workItem from="1538934478875" duration="76000" />
306   - <workItem from="1540900056741" duration="7082000" />
  293 + <workItem from="1540900056741" duration="8173000" />
  294 + <workItem from="1540976986771" duration="2664000" />
307 295 </task>
308 296 <servers />
309 297 </component>
310 298 <component name="TimeTrackingManager">
311   - <option name="totallyTimeSpent" value="24546000" />
  299 + <option name="totallyTimeSpent" value="28301000" />
312 300 </component>
313 301 <component name="ToolWindowManager">
314   - <frame x="0" y="23" width="1440" height="873" extended-state="0" />
  302 + <frame x="1440" y="-180" width="1920" height="1080" extended-state="0" />
315 303 <editor active="true" />
316 304 <layout>
317   - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
  305 + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18746708" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
318 306 <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
319   - <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
320   - <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
321   - <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.329602" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
322   - <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
  307 + <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
  308 + <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
  309 + <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.329602" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
  310 + <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
  311 + <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
323 312 <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
324   - <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
325   - <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
  313 + <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
  314 + <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
  315 + <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
326 316 <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
327   - <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
328 317 <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
329 318 <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
330   - <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
331 319 <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
332   - <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
  320 + <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
  321 + <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
  322 + <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
333 323 <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
334   - <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
335 324 </layout>
336 325 </component>
337 326 <component name="TypeScriptGeneratedFilesManager">
338   - <option name="processedProjectFiles" value="true" />
  327 + <option name="version" value="1" />
339 328 </component>
340 329 <component name="VcsContentAnnotationSettings">
341 330 <option name="myLimit" value="2678400000" />
... ... @@ -353,6 +342,30 @@
353 342 </state>
354 343 </provider>
355 344 </entry>
  345 + <entry file="file://$PROJECT_DIR$/server.js">
  346 + <provider selected="true" editor-type-id="text-editor">
  347 + <state relative-caret-position="105">
  348 + <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
  349 + <folding />
  350 + </state>
  351 + </provider>
  352 + </entry>
  353 + <entry file="file://$PROJECT_DIR$/README.txt">
  354 + <provider selected="true" editor-type-id="text-editor">
  355 + <state relative-caret-position="120">
  356 + <caret line="8" column="58" lean-forward="false" selection-start-line="8" selection-start-column="58" selection-end-line="8" selection-end-column="58" />
  357 + <folding />
  358 + </state>
  359 + </provider>
  360 + </entry>
  361 + <entry file="file://$PROJECT_DIR$/package-lock.json">
  362 + <provider selected="true" editor-type-id="text-editor">
  363 + <state relative-caret-position="0">
  364 + <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
  365 + <folding />
  366 + </state>
  367 + </provider>
  368 + </entry>
356 369 <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
357 370 <provider selected="true" editor-type-id="text-editor">
358 371 <state relative-caret-position="135">
... ... @@ -361,6 +374,14 @@
361 374 </state>
362 375 </provider>
363 376 </entry>
  377 + <entry file="file://$PROJECT_DIR$/package.json">
  378 + <provider selected="true" editor-type-id="text-editor">
  379 + <state relative-caret-position="360">
  380 + <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
  381 + <folding />
  382 + </state>
  383 + </provider>
  384 + </entry>
364 385 <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
365 386 <provider selected="true" editor-type-id="text-editor">
366 387 <state relative-caret-position="0">
... ... @@ -371,15 +392,20 @@
371 392 </entry>
372 393 <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
373 394 <provider selected="true" editor-type-id="text-editor">
374   - <state relative-caret-position="150">
375   - <caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
  395 + <state relative-caret-position="30">
  396 + <caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="19" />
  397 + <folding />
  398 + </state>
  399 + </provider>
  400 + </entry>
  401 + <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
  402 + <provider selected="true" editor-type-id="text-editor">
  403 + <state relative-caret-position="0">
  404 + <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
376 405 <folding />
377 406 </state>
378 407 </provider>
379 408 </entry>
380   - <entry file="file://$PROJECT_DIR$/api/models/evaluationModel.js" />
381   - <entry file="file://$PROJECT_DIR$/api/models/models.js" />
382   - <entry file="file://$PROJECT_DIR$/api/controllers/evaluationController.js" />
383 409 <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
384 410 <provider selected="true" editor-type-id="text-editor">
385 411 <state relative-caret-position="135">
... ... @@ -404,6 +430,17 @@
404 430 </state>
405 431 </provider>
406 432 </entry>
  433 + <entry file="file://$PROJECT_DIR$/api/models/evaluationModel.js" />
  434 + <entry file="file://$PROJECT_DIR$/api/models/models.js" />
  435 + <entry file="file://$PROJECT_DIR$/api/controllers/evaluationController.js" />
  436 + <entry file="file://$PROJECT_DIR$/server.js">
  437 + <provider selected="true" editor-type-id="text-editor">
  438 + <state relative-caret-position="105">
  439 + <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
  440 + <folding />
  441 + </state>
  442 + </provider>
  443 + </entry>
407 444 <entry file="file://$PROJECT_DIR$/README.txt">
408 445 <provider selected="true" editor-type-id="text-editor">
409 446 <state relative-caret-position="120">
... ... @@ -412,10 +449,10 @@
412 449 </state>
413 450 </provider>
414 451 </entry>
415   - <entry file="file://$PROJECT_DIR$/server.js">
  452 + <entry file="file://$PROJECT_DIR$/package-lock.json">
416 453 <provider selected="true" editor-type-id="text-editor">
417   - <state relative-caret-position="105">
418   - <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
  454 + <state relative-caret-position="0">
  455 + <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
419 456 <folding />
420 457 </state>
421 458 </provider>
... ... @@ -428,10 +465,34 @@
428 465 </state>
429 466 </provider>
430 467 </entry>
  468 + <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
  469 + <provider selected="true" editor-type-id="text-editor">
  470 + <state relative-caret-position="0">
  471 + <caret line="0" column="19" lean-forward="false" selection-start-line="0" selection-start-column="19" selection-end-line="0" selection-end-column="19" />
  472 + <folding />
  473 + </state>
  474 + </provider>
  475 + </entry>
  476 + <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
  477 + <provider selected="true" editor-type-id="text-editor">
  478 + <state relative-caret-position="135">
  479 + <caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
  480 + <folding />
  481 + </state>
  482 + </provider>
  483 + </entry>
  484 + <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
  485 + <provider selected="true" editor-type-id="text-editor">
  486 + <state relative-caret-position="30">
  487 + <caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="19" />
  488 + <folding />
  489 + </state>
  490 + </provider>
  491 + </entry>
431 492 <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
432 493 <provider selected="true" editor-type-id="text-editor">
433   - <state relative-caret-position="420">
434   - <caret line="115" column="47" lean-forward="false" selection-start-line="115" selection-start-column="47" selection-end-line="115" selection-end-column="47" />
  494 + <state relative-caret-position="481">
  495 + <caret line="211" column="37" lean-forward="true" selection-start-line="211" selection-start-column="37" selection-end-line="211" selection-end-column="42" />
435 496 <folding />
436 497 </state>
437 498 </provider>
... ...
restApi/api/routes/routes.js
1 1 //All endpoints will be defined in this file
2 2 const Incident = require("../modules/incident.js");
  3 +const Evaluation = require("../modules/evaluation.js");
3 4  
4 5  
5 6 const uuid = require('uuid');
... ... @@ -92,7 +93,7 @@ var appRouter = function(app) {
92 93 //Add a new incident (http://localhost:3000/addIncident - with an "x-www-form-urlencoded" body of params)
93 94 app.post("/addIncident", function(req, res) {
94 95  
95   - /*
  96 + /* Mocdata
96 97 // All these parameters must exist in the body with the exact name for this method to work
97 98 if(!req.body.id || !req.body.date || !req.body.location || !req.body.title || !req.body.description || !req.body.associatedEval) {
98 99 return res.send({"status": "error", "message": "missing a parameters"});
... ... @@ -106,9 +107,6 @@ var appRouter = function(app) {
106 107 */
107 108  
108 109  
109   -
110   -
111   -
112 110 if(!req.body.id || !req.body.date || !req.body.location || !req.body.title || !req.body.description || !req.body.associatedEval) {
113 111 return res.send({"status": "error", "message": "missing a parameters"});
114 112 } else {
... ... @@ -128,7 +126,6 @@ var appRouter = function(app) {
128 126  
129 127  
130 128  
131   -
132 129 //Update an incident (http://localhost:3000/updateIncident?id=1 will update the incident with id=1 with the params passed in the request body)
133 130 app.patch("/updateIncident", function (req, res) {
134 131 var foundIncident = null;
... ... @@ -162,6 +159,79 @@ var appRouter = function(app) {
162 159 return res.send({"status": "success", "message": "Nothing really deleted because this is a mock server but this should delete incident with id: " + req.query.id});
163 160 });
164 161  
  162 +
  163 +
  164 + /**
  165 + * See an evaluation with id x
  166 + */
  167 +
  168 + app.get("/getEvaluation", function (req, res) {
  169 + client.execute('SELECT * FROM risk.evaluation WHERE id=' + req.query.id, [], function(err, result) {
  170 + if(err) {
  171 + console.log(err);
  172 + return res.send({"status": "error", "message": "Missing id, please use /getEvaluation?id=[id]"})
  173 + } else {
  174 + if (result.rows.length != 0)
  175 + return res.send(result.rows[0])
  176 + else
  177 + return res.send({"status": "error", "message": "Id not found"})
  178 + }
  179 + });
  180 +
  181 + })
  182 +
  183 +
  184 + /**
  185 + * See all evaluations
  186 + */
  187 +
  188 + app.get("/getAllEvaluations", function (req, res) {
  189 +
  190 + client.execute('SELECT * FROM risk.evaluation', [], function (err, result) {
  191 + if(err) {
  192 + console.log(err);
  193 + return res.send({"status": "error", "message": "Something went wrong"})
  194 +
  195 + } else {
  196 + if (result.rows.length != 0)
  197 + return res.send(result.rows);
  198 + else
  199 + return res.send({"status": "error", "message": "No registered events"})
  200 + }
  201 +
  202 + })
  203 +
  204 + });
  205 +
  206 +
  207 + /**
  208 + * Add a new evaluation
  209 + */
  210 +
  211 + app.post("/addEvaluation", function(req, res) {
  212 + if(!req.body.id || !req.body.title || !req.body.outcome || !req.body.measures || !req.body.consequence || !req.body.probability || !req.body.associatedActivity) {
  213 + return res.send({"status": "error", "message": "missing a parameters"});
  214 + } else {
  215 + const query = 'INSERT INTO risk.evaluation(id, uuid, title, outcome, measures, consequence, probability, associatedActivity) VALUES(?,?,?,?,?,?,?,?)';
  216 + const params = [req.body.id, uuid(), req.body.title, req.body.outcome, req.body.measures, req.body.consequence, req.body.probability, req.body.associatedActivity];
  217 + client.execute(query, params, { prepare: true }, function (err) {
  218 +
  219 + if (err) {
  220 + console.log(err);
  221 + return res.send({"status": "error", "message": "Something went wrong"})
  222 + }
  223 +
  224 + })
  225 + }
  226 +
  227 + });
  228 +
  229 +
  230 +
  231 +
  232 +
  233 +
165 234 };
166 235  
  236 +
167 237 module.exports = appRouter;
168 238 \ No newline at end of file
... ...