Commit 2269d2da338dc2a316457cce8a867f0fc95f40f2

Authored by Ali B
2 parents e4ad27c9 df758bae

fixed merge conflicts

Thumbs.db
No preview for this file type
restApi/.idea/restApi.iml
... ... @@ -4,15 +4,5 @@
4 4 <content url="file://$MODULE_DIR$" />
5 5 <orderEntry type="inheritedJdk" />
6 6 <orderEntry type="sourceFolder" forTests="false" />
7   - <orderEntry type="module-library">
8   - <library name="PHP Runtime" type="php">
9   - <CLASSES>
10   - <root url="jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard" />
11   - </CLASSES>
12   - <SOURCES>
13   - <root url="jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard" />
14   - </SOURCES>
15   - </library>
16   - </orderEntry>
17 7 </component>
18 8 </module>
19 9 \ No newline at end of file
... ...
restApi/.idea/workspace.xml deleted
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<project version="4">
3   - <component name="ChangeListManager">
4   - <list default="true" id="8a337026-05ab-47b0-872d-ab1e8037e9a0" name="Default" comment="">
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" />
7   - </list>
8   - <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
9   - <option name="TRACKING_ENABLED" value="true" />
10   - <option name="SHOW_DIALOG" value="false" />
11   - <option name="HIGHLIGHT_CONFLICTS" value="true" />
12   - <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
13   - <option name="LAST_RESOLUTION" value="IGNORE" />
14   - </component>
15   - <component name="CreatePatchCommitExecutor">
16   - <option name="PATCH_PATH" value="" />
17   - </component>
18   - <component name="FUSProjectUsageTrigger">
19   - <session id="920369055">
20   - <usages-collector id="statistics.lifecycle.project">
21   - <counts>
22   - <entry key="project.closed" value="3" />
23   - <entry key="project.open.time.16" value="1" />
24   - <entry key="project.open.time.5" value="1" />
25   - <entry key="project.open.time.59" value="1" />
26   - <entry key="project.opened" value="3" />
27   - </counts>
28   - </usages-collector>
29   - <usages-collector id="statistics.file.extensions.edit">
30   - <counts>
31   - <entry key="js" value="4909" />
32   - <entry key="json" value="3" />
33   - </counts>
34   - </usages-collector>
35   - <usages-collector id="statistics.file.types.edit">
36   - <counts>
37   - <entry key="JSON" value="3" />
38   - <entry key="JavaScript" value="4909" />
39   - </counts>
40   - </usages-collector>
41   - <usages-collector id="statistics.file.extensions.open">
42   - <counts>
43   - <entry key="js" value="8" />
44   - </counts>
45   - </usages-collector>
46   - <usages-collector id="statistics.file.types.open">
47   - <counts>
48   - <entry key="JavaScript" value="8" />
49   - </counts>
50   - </usages-collector>
51   - </session>
52   - </component>
53   - <component name="FileEditorManager">
54   - <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
55   - <file leaf-file-name="routes.js" pinned="false" current-in-tab="true">
56   - <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
57   - <provider selected="true" editor-type-id="text-editor">
58   - <state relative-caret-position="690">
59   - <caret line="46" column="0" lean-forward="false" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" />
60   - <folding />
61   - </state>
62   - </provider>
63   - </entry>
64   - </file>
65   - <file leaf-file-name="server.js" pinned="false" current-in-tab="false">
66   - <entry file="file://$PROJECT_DIR$/server.js">
67   - <provider selected="true" editor-type-id="text-editor">
68   - <state relative-caret-position="105">
69   - <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
70   - <folding />
71   - </state>
72   - </provider>
73   - </entry>
74   - </file>
75   - <file leaf-file-name="README.txt" pinned="false" current-in-tab="false">
76   - <entry file="file://$PROJECT_DIR$/README.txt">
77   - <provider selected="true" editor-type-id="text-editor">
78   - <state relative-caret-position="30">
79   - <caret line="2" column="50" lean-forward="false" selection-start-line="2" selection-start-column="50" selection-end-line="2" selection-end-column="81" />
80   - <folding />
81   - </state>
82   - </provider>
83   - </entry>
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>
95   - <file leaf-file-name="package.json" pinned="false" current-in-tab="false">
96   - <entry file="file://$PROJECT_DIR$/package.json">
97   - <provider selected="true" editor-type-id="text-editor">
98   - <state relative-caret-position="360">
99   - <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
100   - <folding />
101   - </state>
102   - </provider>
103   - </entry>
104   - </file>
105   - <file leaf-file-name="incident.js" pinned="false" current-in-tab="false">
106   - <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
107   - <provider selected="true" editor-type-id="text-editor">
108   - <state relative-caret-position="135">
109   - <caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
110   - <folding />
111   - </state>
112   - </provider>
113   - </entry>
114   - </file>
115   - <file leaf-file-name="activity.js" pinned="false" current-in-tab="false">
116   - <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
117   - <provider selected="true" editor-type-id="text-editor">
118   - <state relative-caret-position="105">
119   - <caret line="7" column="23" lean-forward="true" selection-start-line="7" selection-start-column="23" selection-end-line="7" selection-end-column="23" />
120   - <folding />
121   - </state>
122   - </provider>
123   - </entry>
124   - </file>
125   - <file leaf-file-name="evaluation.js" pinned="false" current-in-tab="false">
126   - <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
127   - <provider selected="true" editor-type-id="text-editor">
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" />
130   - <folding />
131   - </state>
132   - </provider>
133   - </entry>
134   - </file>
135   - </leaf>
136   - </component>
137   - <component name="FileTemplateManagerImpl">
138   - <option name="RECENT_TEMPLATES">
139   - <list>
140   - <option value="JavaScript File" />
141   - </list>
142   - </option>
143   - </component>
144   - <component name="FindInProjectRecents">
145   - <findStrings>
146   - <find>get</find>
147   - <find>.get</find>
148   - </findStrings>
149   - </component>
150   - <component name="Git.Settings">
151   - <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
152   - </component>
153   - <component name="GradleLocalSettings">
154   - <option name="modificationStamps">
155   - <map>
156   - <entry key="$PROJECT_DIR$/../New Folder" value="7397988581076" />
157   - </map>
158   - </option>
159   - <option name="externalProjectsViewState">
160   - <projects_view />
161   - </option>
162   - </component>
163   - <component name="IdeDocumentHistory">
164   - <option name="CHANGED_PATHS">
165   - <list>
166   - <option value="$PROJECT_DIR$/api/controllers/risikoController.js" />
167   - <option value="$PROJECT_DIR$/api/models/evaluationModel.js" />
168   - <option value="$PROJECT_DIR$/api/routes/evaluationRoutes.js" />
169   - <option value="$PROJECT_DIR$/api/models/Incident.js" />
170   - <option value="$PROJECT_DIR$/api/models/models.js" />
171   - <option value="$PROJECT_DIR$/api/models/incident.js" />
172   - <option value="$PROJECT_DIR$/api/modules/incident.js" />
173   - <option value="$PROJECT_DIR$/api/modules/evaluation.js" />
174   - <option value="$PROJECT_DIR$/api/modules/activity.js" />
175   - <option value="$PROJECT_DIR$/server.js" />
176   - <option value="$PROJECT_DIR$/package.json" />
177   - <option value="$PROJECT_DIR$/api/routes/routes.js" />
178   - </list>
179   - </option>
180   - </component>
181   - <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
182   - <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER">
183   - <package-json value="$PROJECT_DIR$/package.json" />
184   - </component>
185   - <component name="JsGulpfileManager">
186   - <detection-done>true</detection-done>
187   - <sorting>DEFINITION_ORDER</sorting>
188   - </component>
189   - <component name="NodeModulesDirectoryManager">
190   - <handled-path value="$PROJECT_DIR$/node_modules" />
191   - </component>
192   - <component name="NodePackageJsonFileManager">
193   - <packageJsonPaths>
194   - <path value="$PROJECT_DIR$/package.json" />
195   - </packageJsonPaths>
196   - </component>
197   - <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
198   - <component name="ProjectFrameBounds" fullScreen="true">
199   - <option name="x" value="1360" />
200   - <option name="y" value="23" />
201   - <option name="width" value="80" />
202   - <option name="height" value="22" />
203   - </component>
204   - <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
205   - <component name="ProjectView">
206   - <navigator currentView="ProjectPane" proportions="" version="1">
207   - <flattenPackages />
208   - <showMembers />
209   - <showModules />
210   - <showLibraryContents />
211   - <hideEmptyPackages />
212   - <abbreviatePackageNames />
213   - <autoscrollToSource />
214   - <autoscrollFromSource />
215   - <sortByType />
216   - <manualOrder />
217   - <foldersAlwaysOnTop value="true" />
218   - </navigator>
219   - <panes>
220   - <pane id="ProjectPane">
221   - <subPane>
222   - <expand>
223   - <path>
224   - <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
225   - <item name="restApi" type="462c0819:PsiDirectoryNode" />
226   - </path>
227   - <path>
228   - <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
229   - <item name="restApi" type="462c0819:PsiDirectoryNode" />
230   - <item name="api" type="462c0819:PsiDirectoryNode" />
231   - </path>
232   - <path>
233   - <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
234   - <item name="restApi" type="462c0819:PsiDirectoryNode" />
235   - <item name="api" type="462c0819:PsiDirectoryNode" />
236   - <item name="modules" type="462c0819:PsiDirectoryNode" />
237   - </path>
238   - <path>
239   - <item name="restApi" type="b2602c69:ProjectViewProjectNode" />
240   - <item name="restApi" type="462c0819:PsiDirectoryNode" />
241   - <item name="api" type="462c0819:PsiDirectoryNode" />
242   - <item name="routes" type="462c0819:PsiDirectoryNode" />
243   - </path>
244   - </expand>
245   - <select />
246   - </subPane>
247   - </pane>
248   - <pane id="Scratches" />
249   - <pane id="Scope" />
250   - </panes>
251   - </component>
252   - <component name="PropertiesComponent">
253   - <property name="WebServerToolWindowFactoryState" value="false" />
254   - <property name="last_opened_file_path" value="$PROJECT_DIR$" />
255   - <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
256   - <property name="nodejs_interpreter_path" value="/usr/local/bin/node" />
257   - </component>
258   - <component name="RunDashboard">
259   - <option name="ruleStates">
260   - <list>
261   - <RuleState>
262   - <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
263   - </RuleState>
264   - <RuleState>
265   - <option name="name" value="StatusDashboardGroupingRule" />
266   - </RuleState>
267   - </list>
268   - </option>
269   - </component>
270   - <component name="RunManager">
271   - <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" path-to-node="project" working-dir="">
272   - <method />
273   - </configuration>
274   - </component>
275   - <component name="ShelveChangesManager" show_recycled="false">
276   - <option name="remove_strategy" value="false" />
277   - </component>
278   - <component name="SvnConfiguration">
279   - <configuration />
280   - </component>
281   - <component name="TaskManager">
282   - <task active="true" id="Default" summary="Default task">
283   - <changelist id="8a337026-05ab-47b0-872d-ab1e8037e9a0" name="Default" comment="" />
284   - <created>1538753503688</created>
285   - <option name="number" value="Default" />
286   - <option name="presentableId" value="Default" />
287   - <updated>1538753503688</updated>
288   - <workItem from="1538753505199" duration="609000" />
289   - <workItem from="1538754856928" duration="649000" />
290   - <workItem from="1538838941552" duration="10339000" />
291   - <workItem from="1538928470276" duration="5791000" />
292   - <workItem from="1538934478875" duration="76000" />
293   - <workItem from="1540900056741" duration="8173000" />
294   - <workItem from="1540976986771" duration="7543000" />
295   - <workItem from="1540993198725" duration="335000" />
296   - </task>
297   - <servers />
298   - </component>
299   - <component name="TimeTrackingManager">
300   - <option name="totallyTimeSpent" value="33515000" />
301   - </component>
302   - <component name="ToolWindowManager">
303   - <frame x="0" y="0" width="1440" height="900" extended-state="0" />
304   - <editor active="true" />
305   - <layout>
306   - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17195208" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
307   - <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" />
308   - <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="10" side_tool="false" content_ui="tabs" />
309   - <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" />
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="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="8" side_tool="false" content_ui="tabs" />
312   - <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" />
313   - <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" />
314   - <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="9" side_tool="false" 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" />
316   - <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="3" side_tool="true" content_ui="tabs" />
317   - <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" />
318   - <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" />
319   - <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" />
320   - <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" />
321   - <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" />
322   - <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" />
323   - <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" />
324   - <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" />
325   - </layout>
326   - </component>
327   - <component name="TypeScriptGeneratedFilesManager">
328   - <option name="version" value="1" />
329   - </component>
330   - <component name="VcsContentAnnotationSettings">
331   - <option name="myLimit" value="2678400000" />
332   - </component>
333   - <component name="XDebuggerManager">
334   - <breakpoint-manager />
335   - <watches-manager />
336   - </component>
337   - <component name="editorHistoryManager">
338   - <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
339   - <provider selected="true" editor-type-id="text-editor">
340   - <state relative-caret-position="690">
341   - <caret line="46" column="0" lean-forward="false" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" />
342   - <folding />
343   - </state>
344   - </provider>
345   - </entry>
346   - <entry file="file://$PROJECT_DIR$/server.js">
347   - <provider selected="true" editor-type-id="text-editor">
348   - <state relative-caret-position="105">
349   - <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
350   - <folding />
351   - </state>
352   - </provider>
353   - </entry>
354   - <entry file="file://$PROJECT_DIR$/package-lock.json">
355   - <provider selected="true" editor-type-id="text-editor">
356   - <state relative-caret-position="0">
357   - <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
358   - <folding />
359   - </state>
360   - </provider>
361   - </entry>
362   - <entry file="file://$PROJECT_DIR$/package.json">
363   - <provider selected="true" editor-type-id="text-editor">
364   - <state relative-caret-position="360">
365   - <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
366   - <folding />
367   - </state>
368   - </provider>
369   - </entry>
370   - <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
371   - <provider selected="true" editor-type-id="text-editor">
372   - <state relative-caret-position="135">
373   - <caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
374   - <folding />
375   - </state>
376   - </provider>
377   - </entry>
378   - <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
379   - <provider selected="true" editor-type-id="text-editor">
380   - <state relative-caret-position="105">
381   - <caret line="7" column="23" lean-forward="true" selection-start-line="7" selection-start-column="23" selection-end-line="7" selection-end-column="23" />
382   - <folding />
383   - </state>
384   - </provider>
385   - </entry>
386   - <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
387   - <provider selected="true" editor-type-id="text-editor">
388   - <state relative-caret-position="30">
389   - <caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="19" />
390   - <folding />
391   - </state>
392   - </provider>
393   - </entry>
394   - <entry file="file://$PROJECT_DIR$/README.txt">
395   - <provider selected="true" editor-type-id="text-editor">
396   - <state relative-caret-position="30">
397   - <caret line="2" column="50" lean-forward="true" selection-start-line="2" selection-start-column="50" selection-end-line="2" selection-end-column="81" />
398   - <folding />
399   - </state>
400   - </provider>
401   - </entry>
402   - <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
403   - <provider selected="true" editor-type-id="text-editor">
404   - <state relative-caret-position="0">
405   - <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
406   - <folding />
407   - </state>
408   - </provider>
409   - </entry>
410   - <entry file="file://$PROJECT_DIR$/server.js">
411   - <provider selected="true" editor-type-id="text-editor">
412   - <state relative-caret-position="105">
413   - <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
414   - <folding />
415   - </state>
416   - </provider>
417   - </entry>
418   - <entry file="file://$PROJECT_DIR$/README.txt">
419   - <provider selected="true" editor-type-id="text-editor">
420   - <state relative-caret-position="120">
421   - <caret line="8" column="58" lean-forward="false" selection-start-line="8" selection-start-column="58" selection-end-line="8" selection-end-column="58" />
422   - <folding />
423   - </state>
424   - </provider>
425   - </entry>
426   - <entry file="file://$PROJECT_DIR$/package-lock.json">
427   - <provider selected="true" editor-type-id="text-editor">
428   - <state relative-caret-position="0">
429   - <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
430   - <folding />
431   - </state>
432   - </provider>
433   - </entry>
434   - <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
435   - <provider selected="true" editor-type-id="text-editor">
436   - <state relative-caret-position="135">
437   - <caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
438   - <folding />
439   - </state>
440   - </provider>
441   - </entry>
442   - <entry file="file://$PROJECT_DIR$/package.json">
443   - <provider selected="true" editor-type-id="text-editor">
444   - <state relative-caret-position="360">
445   - <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
446   - <folding />
447   - </state>
448   - </provider>
449   - </entry>
450   - <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
451   - <provider selected="true" editor-type-id="text-editor">
452   - <state relative-caret-position="0">
453   - <caret line="0" column="19" lean-forward="false" selection-start-line="0" selection-start-column="19" selection-end-line="0" selection-end-column="19" />
454   - <folding />
455   - </state>
456   - </provider>
457   - </entry>
458   - <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
459   - <provider selected="true" editor-type-id="text-editor">
460   - <state relative-caret-position="30">
461   - <caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="19" />
462   - <folding />
463   - </state>
464   - </provider>
465   - </entry>
466   - <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
467   - <provider selected="true" editor-type-id="text-editor">
468   - <state relative-caret-position="0">
469   - <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
470   - <folding />
471   - </state>
472   - </provider>
473   - </entry>
474   - <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
475   - <provider selected="true" editor-type-id="text-editor">
476   - <state relative-caret-position="135">
477   - <caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
478   - <folding />
479   - </state>
480   - </provider>
481   - </entry>
482   - <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
483   - <provider selected="true" editor-type-id="text-editor">
484   - <state relative-caret-position="0">
485   - <caret line="0" column="19" lean-forward="false" selection-start-line="0" selection-start-column="19" selection-end-line="0" selection-end-column="19" />
486   - <folding />
487   - </state>
488   - </provider>
489   - </entry>
490   - <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
491   - <provider selected="true" editor-type-id="text-editor">
492   - <state relative-caret-position="150">
493   - <caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
494   - <folding />
495   - </state>
496   - </provider>
497   - </entry>
498   - <entry file="file://$PROJECT_DIR$/api/models/evaluationModel.js" />
499   - <entry file="file://$PROJECT_DIR$/api/models/models.js" />
500   - <entry file="file://$PROJECT_DIR$/api/controllers/evaluationController.js" />
501   - <entry file="file://$PROJECT_DIR$/server.js">
502   - <provider selected="true" editor-type-id="text-editor">
503   - <state relative-caret-position="105">
504   - <caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
505   - <folding />
506   - </state>
507   - </provider>
508   - </entry>
509   - <entry file="file://$PROJECT_DIR$/package-lock.json">
510   - <provider selected="true" editor-type-id="text-editor">
511   - <state relative-caret-position="0">
512   - <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
513   - <folding />
514   - </state>
515   - </provider>
516   - </entry>
517   - <entry file="file://$PROJECT_DIR$/package.json">
518   - <provider selected="true" editor-type-id="text-editor">
519   - <state relative-caret-position="360">
520   - <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
521   - <folding />
522   - </state>
523   - </provider>
524   - </entry>
525   - <entry file="file://$PROJECT_DIR$/api/modules/incident.js">
526   - <provider selected="true" editor-type-id="text-editor">
527   - <state relative-caret-position="135">
528   - <caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
529   - <folding />
530   - </state>
531   - </provider>
532   - </entry>
533   - <entry file="file://$PROJECT_DIR$/api/modules/evaluation.js">
534   - <provider selected="true" editor-type-id="text-editor">
535   - <state relative-caret-position="30">
536   - <caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="19" />
537   - <folding />
538   - </state>
539   - </provider>
540   - </entry>
541   - <entry file="file://$PROJECT_DIR$/api/modules/activity.js">
542   - <provider selected="true" editor-type-id="text-editor">
543   - <state relative-caret-position="105">
544   - <caret line="7" column="23" lean-forward="true" selection-start-line="7" selection-start-column="23" selection-end-line="7" selection-end-column="23" />
545   - <folding />
546   - </state>
547   - </provider>
548   - </entry>
549   - <entry file="file://$PROJECT_DIR$/README.txt">
550   - <provider selected="true" editor-type-id="text-editor">
551   - <state relative-caret-position="30">
552   - <caret line="2" column="50" lean-forward="false" selection-start-line="2" selection-start-column="50" selection-end-line="2" selection-end-column="81" />
553   - <folding />
554   - </state>
555   - </provider>
556   - </entry>
557   - <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
558   - <provider selected="true" editor-type-id="text-editor">
559   - <state relative-caret-position="690">
560   - <caret line="46" column="0" lean-forward="false" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" />
561   - <folding />
562   - </state>
563   - </provider>
564   - </entry>
565   - </component>
566   -</project>
567 0 \ No newline at end of file
restApi/api/routes/routes.js
... ... @@ -3,40 +3,10 @@ const Incident = require(&quot;../modules/incident.js&quot;);
3 3 const Evaluation = require("../modules/evaluation.js");
4 4 const Activity = require("../modules/activity.js");
5 5  
6   -
7 6 const uuid = require('uuid');
8 7 var cassandra = require("cassandra-driver");
9 8  
10   -var client = new cassandra.Client({contactPoints: ['127.0.0.1']});
11   -client.connect(function (err, result) {
12   - if(err) console.log("Could not connect to Cassandra");
13   - console.log('Successfully connected to Cassandra');
14   -});
15   -
16   -
17   -client.execute("CREATE KEYSPACE IF NOT EXISTS risk WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1};", function (err) {
18   - if (err) console.log("Failed to create keyspace. Error: " + err);
19   -
20   - client.execute("CREATE TABLE risk.incident(uuid uuid, id int, date date, location text, title text, description text, associatedEval int, PRIMARY KEY(id));", function (err) {
21   - if (err) console.log("Failed to create table incident. Error: " + err)
22   - });
23   -
24   - client.execute("CREATE TABLE risk.evaluation(id int, uuid uuid, title text, outcome text, measures text, consequence int, probability int, associatedActivity int, PRIMARY KEY(id));", function (err) {
25   - if (err) console.log("Failed to create table evaluation. Error: " + err)
26   - });
27   -
28   - client.execute("CREATE TABLE risk.activity(id int, uuid uuid, title text, PRIMARY KEY(id));", function (err) {
29   - if (err) console.log("Failed to create table activity. Error: " + err)
30   - });
31   -});
32   -
33   -
34   -
35   -var mockIncidents = [
36   - new Incident("1", "03.03.2018", "Bodø", "Datt på isen", "Datt på isen når jeg skuplle gå til bilen", "4"),
37   - new Incident("2", "11.11.2012", "Oslo", "Bilkræsj", "Kræsjet med en annen bil", "2"),
38   - new Incident("3", "26.04.2018", "Bodø", "Tråkket over", "Tråkket over og vrikket foten", "5")
39   -];
  9 +var client = setupDatabase('127.0.0.1');
40 10  
41 11 var appRouter = function(app) {
42 12  
... ... @@ -47,20 +17,21 @@ var appRouter = function(app) {
47 17  
48 18  
49 19 /**
50   - * Get incident by id endpoint (http://localhost:3000/getIncident?id=1 will return incident with id 1)
  20 + * Get incident by id endpoint (a get request at http://localhost:3000/incident/1 will return incident with id 1)
51 21 */
  22 + app.get("/incident/:id", function (req, res) {
  23 + if (!req.params.id) return req.status(400).send("No id entered");
52 24  
53   - app.get("/getIncident", function (req, res) {
54   -
55   - client.execute('SELECT * FROM risk.incident WHERE id=' + req.query.id, [], function(err, result) {
  25 + const params = [req.params.id];
  26 + client.execute('SELECT * FROM risk.incident WHERE id = ?', params,{ prepare: true }, function(err, result) {
56 27 if(err) {
57 28 console.log(err);
58   - return res.send({"status": "error", "message": "Missing id, please use /getIncident?id=[id]"})
  29 + return res.status(400).send("Bad Request, make sure to send a request with an id")
59 30 } else {
60 31 if (result.rows.length != 0)
61   - return res.send(result.rows[0])
  32 + return res.status(200).send(result.rows[0]);
62 33 else
63   - return res.send({"status": "error", "message": "Id not found"})
  34 + return res.status(204).send("Id not found in database");
64 35  
65 36 }
66 37 });
... ... @@ -68,21 +39,20 @@ var appRouter = function(app) {
68 39 });
69 40  
70 41 /**
71   - * See all incidents
  42 + * See all incidents (a get request at http://localhost:3000/incident will return all incidents)
72 43 */
  44 + app.get("/incident", function (req, res) {
73 45  
74   - app.get("/getAllIncidents", function (req, res) {
75   -
76   - client.execute('SELECT * FROM risk.incident', [], function (err, result) {
  46 + client.execute('SELECT * FROM risk.incident', function (err, result) {
77 47 if(err) {
78 48 console.log(err);
79   - return res.send({"status": "error", "message": "Something went wrong"})
  49 + return res.status(400).send("Bad Request");
80 50  
81 51 } else {
82 52 if (result.rows.length != 0)
83   - return res.send(result.rows);
  53 + return res.status(200).send(result.rows);
84 54 else
85   - return res.send({"status": "error", "message": "No registered incidents"})
  55 + return res.status(204).send("No registered incidents");
86 56 }
87 57  
88 58 })
... ... @@ -90,23 +60,22 @@ var appRouter = function(app) {
90 60 });
91 61  
92 62 /**
93   - * Add a new incident (http://localhost:3000/addIncident - with an "x-www-form-urlencoded" body of params)
  63 + * Add a new incident (a post request at http://localhost:3000/incident - with an "x-www-form-urlencoded" body of params)
94 64 */
95   -
96   - app.post("/addIncident", function(req, res) {
  65 + app.post("/incident", function(req, res) {
97 66  
98 67 // All these parameters must exist in the body with the exact name for this method to work
99 68 if(!req.body.id || !req.body.date || !req.body.location || !req.body.title || !req.body.description || !req.body.associatedEval) {
100   - return res.send({"status": "error", "message": "missing a parameters"});
  69 + return res.status(400).send("Missing params");
101 70 } else {
102 71 const query = 'INSERT INTO risk.incident(id, uuid, date, location, title, description, associatedEval) VALUES(?,?,?,?,?,?,?)';
103 72 const params = [req.body.id, uuid(), new Date(req.body.date), req.body.location, req.body.title, req.body.description, req.body.associatedEval];
104 73 client.execute(query, params, { prepare: true }, function (err) {
105   - //Here the request is successful and should be saved in the database
106 74 if (err) {
107 75 console.log(err);
108   - return res.send({"status": "error", "message": "Something went wrong"})
  76 + return res.status(400).send("Bad Request");
109 77 }
  78 + return res.status(200).send("Incident Created");
110 79  
111 80 })
112 81 }
... ... @@ -114,84 +83,80 @@ var appRouter = function(app) {
114 83 });
115 84  
116 85 /**
117   - * Update an incident (http://localhost:3000/updateIncident?id=1 will update the incident with id=1 with the params passed in the request body)
  86 + * Update an incident (a patch request at http://localhost:3000/incident/{id} will update the incident with the params passed in the request body)
118 87 */
  88 + app.patch("/incident/:id", function (req, res) {
119 89  
120 90  
121   - app.patch("/updateIncident", function (req, res) {
122   - var foundIncident = null;
  91 + if (!req.params.id) return res.status(400).send("Missing id");
123 92  
124   - //Search the array with mockIncidents and if id is found stop the loop and set foundIncident variable
125   - mockIncidents.forEach(function (value) {
126   - if (value.id === req.query.id) {
127   - foundIncident = value;
128   - return true;
129   - }
  93 + if(!req.body.date || !req.body.location || !req.body.title || !req.body.description || !req.body.associatedEval) {
  94 + return res.status(400).send("Missing params");
  95 + }
130 96  
131   - //Only mock so nothing is really happening here, here the database should be updated
132   - if (foundIncident != null) {
133   - if (req.body.date !== null) foundIncident.date = req.body.date;
134   - if (req.body.location !== null) foundIncident.location = req.body.location;
135   - if (req.body.title !== null) foundIncident.title = req.body.title;
136   - if (req.body.description !== null) foundIncident.description = req.body.description;
137   - if (req.body.associatedEval !== null) foundIncident.associatedEval = req.body.associatedEval;
138   - return res.send({"status": "success", "message": "Incident updated"});
  97 + const params = [new Date(req.body.date), req.body.location, req.body.title, req.body.description, req.body.associatedEval, req.params.id];
  98 + client.execute("UPDATE risk.incident SET date=?, location=?, title=?, description=?, associatedEval=? WHERE id=?", params,{ prepare: true }, function (err) {
  99 + if (err) {
  100 + console.log(err);
  101 + return res.status(400).send("Bad Request");
139 102 }
  103 + return res.status(200).send("Incident updated");
  104 + });
140 105  
141   - return res.send({"status": "error", "message": "Id missing"});
142 106  
143   - });
144   - });
145 107  
  108 + });
146 109  
147 110 /**
148   - * Delete an incident (http://localhost:3000/deleteIncident?id=1 should delete incident with id=1)
  111 + * Delete an incident (a delete request at http://localhost:3000/incident/{id} should delete incident with id=1)
149 112 */
  113 + app.delete("/incident/:id", function (req, res) {
  114 + if (!req.params.id) return res.status(400).send("Missing id");
  115 + const params = [req.params.id];
  116 + client.execute("DELETE FROM risk.incident WHERE id = ?", params,{ prepare: true }, function (err) {
  117 + if (err) return res.status(400).send("Bad request");
  118 + return res.status(200).send("Incident deleted");
150 119  
151   - app.delete("/deleteIncident", function (req, res) {
152   - if (!req.query.id) return res.send({"status": "failed", "message": "Id missing"});
153   -
154   - 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});
  120 + });
155 121 });
156 122  
157   -
158   -
159 123 /**
160 124 * See an evaluation with id x
161 125 */
  126 + app.get("/evaluation/:id", function (req, res) {
  127 + if (!req.params.id) return req.status(400).send("No id entered");
162 128  
163   - app.get("/getEvaluation", function (req, res) {
164   - client.execute('SELECT * FROM risk.evaluation WHERE id=' + req.query.id, [], function(err, result) {
  129 + const params = [req.params.id];
  130 + client.execute('SELECT * FROM risk.evaluation WHERE id = ?', params,{ prepare: true}, function(err, result) {
165 131 if(err) {
166 132 console.log(err);
167   - return res.send({"status": "error", "message": "Missing id, please use /getEvaluation?id=[id]"})
  133 + return res.status(400).send("Bad Request, make sure to send a request with an id")
168 134 } else {
169 135 if (result.rows.length != 0)
170   - return res.send(result.rows[0])
  136 + return res.status(200).send(result.rows[0]);
171 137 else
172   - return res.send({"status": "error", "message": "Id not found"})
  138 + return res.status(204).send("Id not found in database");
173 139 }
174 140 });
175 141  
176   - })
  142 + });
177 143  
178 144  
179 145 /**
180 146 * See all evaluations
181 147 */
182   -
183   - app.get("/getAllEvaluations", function (req, res) {
  148 + app.get("/evaluation", function (req, res) {
184 149  
185 150 client.execute('SELECT * FROM risk.evaluation', [], function (err, result) {
186 151 if(err) {
187 152 console.log(err);
188   - return res.send({"status": "error", "message": "Something went wrong"})
  153 + return res.status(400).send("Bad Request");
189 154  
190 155 } else {
191 156 if (result.rows.length != 0)
192   - return res.send(result.rows);
  157 + return res.status(200).send(result.rows);
193 158 else
194   - return res.send({"status": "error", "message": "No registered events"})
  159 + return res.status(204).send("No registered evaluations");
195 160 }
196 161  
197 162 })
... ... @@ -202,10 +167,9 @@ var appRouter = function(app) {
202 167 /**
203 168 * Add a new evaluation
204 169 */
205   -
206   - app.post("/addEvaluation", function(req, res) {
  170 + app.post("/evaluation", function(req, res) {
207 171 if(!req.body.id || !req.body.title || !req.body.outcome || !req.body.measures || !req.body.consequence || !req.body.probability || !req.body.associatedActivity) {
208   - return res.send({"status": "error", "message": "missing a parameter"});
  172 + return res.status(400).send("Missing params");
209 173 } else {
210 174 const query = 'INSERT INTO risk.evaluation(id, uuid, title, outcome, measures, consequence, probability, associatedActivity) VALUES(?,?,?,?,?,?,?,?)';
211 175 const params = [req.body.id, uuid(), req.body.title, req.body.outcome, req.body.measures, req.body.consequence, req.body.probability, req.body.associatedActivity];
... ... @@ -213,8 +177,9 @@ var appRouter = function(app) {
213 177  
214 178 if (err) {
215 179 console.log(err);
216   - return res.send({"status": "error", "message": "Something went wrong"})
  180 + return res.status(400).send("Bad Request");
217 181 }
  182 + return res.status(200).send("Evaluation Created");
218 183  
219 184 })
220 185 }
... ... @@ -225,17 +190,19 @@ var appRouter = function(app) {
225 190 /**
226 191 * See an activity with id x
227 192 */
  193 + app.get("/activity/:id", function (req, res) {
  194 + if (!req.params.id) return req.status(400).send("No id entered");
228 195  
229   - app.get("/getActivity", function (req, res) {
230   - client.execute('SELECT * FROM risk.activity WHERE id=' + req.query.id, [], function(err, result) {
  196 + const params = [req.params.id];
  197 + client.execute('SELECT * FROM risk.activity WHERE id = ?', params,{ prepare : true}, function(err, result) {
231 198 if(err) {
232 199 console.log(err);
233   - return res.send({"status": "error", "message": "Missing id, please use /getActivity?id=[id]"})
  200 + return res.status(400).send("Bad Request, make sure to send a request with an id")
234 201 } else {
235 202 if (result.rows.length != 0)
236   - return res.send(result.rows[0])
  203 + return res.status(200).send(result.rows[0]);
237 204 else
238   - return res.send({"status": "error", "message": "Id not found"})
  205 + return res.status(204).send("Id not found in database");
239 206 }
240 207 });
241 208  
... ... @@ -246,19 +213,18 @@ var appRouter = function(app) {
246 213 /**
247 214 * See all activities
248 215 */
249   -
250   - app.get("/getAllActivities", function (req, res) {
  216 + app.get("/activity", function (req, res) {
251 217  
252 218 client.execute('SELECT * FROM risk.activity', [], function (err, result) {
253 219 if(err) {
254 220 console.log(err);
255   - return res.send({"status": "error", "message": "Something went wrong"})
  221 + return res.status(400).send("Bad Request");
256 222  
257 223 } else {
258 224 if (result.rows.length != 0)
259   - return res.send(result.rows);
  225 + return res.status(200).send(result.rows);
260 226 else
261   - return res.send({"status": "error", "message": "No registered activities"})
  227 + return res.status(204).send("No registered activities");
262 228 }
263 229  
264 230 })
... ... @@ -268,5 +234,40 @@ var appRouter = function(app) {
268 234  
269 235 };
270 236  
  237 +/**
  238 + * Sets up connection to the database at a given contact point
  239 + * @param contactPoint: cassandra contact point to connect to
  240 + */
  241 +function setupDatabase(contactPoint) {
  242 + var client = new cassandra.Client({contactPoints: [contactPoint]});
  243 + client.connect(function (err, result) {
  244 + if(err) console.log("Could not connect to Cassandra at " + contactPoint);
  245 + console.log('Successfully connected to Cassandra at ' + contactPoint);
  246 + setupTables(client);
  247 + });
  248 + return client;
  249 +}
  250 +
  251 +/**
  252 +Creates keyspace and all tables needed if they don't exist
  253 + */
  254 +function setupTables(client) {
  255 + client.execute("CREATE KEYSPACE IF NOT EXISTS risk WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1};", function (err) {
  256 + if (err) console.log("Failed to create keyspace. Error: " + err);
  257 +
  258 + client.execute("CREATE TABLE risk.incident(uuid uuid, id int, date date, location text, title text, description text, associatedEval int, PRIMARY KEY(id));", function (err) {
  259 + if (err) console.log("Failed to create table incident.\n" + err)
  260 + });
  261 +
  262 + client.execute("CREATE TABLE risk.evaluation(id int, uuid uuid, title text, outcome text, measures text, consequence int, probability int, associatedActivity int, PRIMARY KEY(id));", function (err) {
  263 + if (err) console.log("Failed to create table evaluation.\n" + err)
  264 + });
  265 +
  266 + client.execute("CREATE TABLE risk.activity(id int, uuid uuid, title text, PRIMARY KEY(id));", function (err) {
  267 + if (err) console.log("Failed to create table activity.\n" + err)
  268 + });
  269 + });
  270 +}
  271 +
271 272  
272 273 module.exports = appRouter;
273 274 \ No newline at end of file
... ...
restApi/server.js
... ... @@ -4,10 +4,6 @@ var bodyParser = require(&quot;body-parser&quot;);
4 4 var app = express();
5 5  
6 6  
7   -
8   -
9   -
10   -
11 7 app.use(bodyParser.json());
12 8 app.use(bodyParser.urlencoded({ extended: true }));
13 9  
... ...