Skip to content

Commit

Permalink
Setting up database
Browse files Browse the repository at this point in the history
  • Loading branch information
AlistairMRoss committed Oct 7, 2023
1 parent bb64a14 commit dd7a670
Show file tree
Hide file tree
Showing 45 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { defineConfig } = require("cypress");
module.exports = defineConfig({
projectId: "8o48nn",
e2e: {
baseUrl: "http://ec2-52-91-180-105.compute-1.amazonaws.com:8080",
baseUrl: "http://localhost:8080",
viewportWidth: 1024,
viewportHeight: 768,
},
Expand Down
8 changes: 4 additions & 4 deletions frontend/infosafe_frontend/src/components/Charts/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ export const Dashboard = () => {
const accessToken = sessionStorage.getItem('accessToken');

const fetchPromises = [
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/notifications/getNotifications', {
await fetch('http://localhost:8080/api/notifications/getNotifications', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/supportrequest/getMyTotal', {
await fetch('http://localhost:8080/api/supportrequest/getMyTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/accessrequest/getMyTotal', {
await fetch('http://localhost:8080/api/accessrequest/getMyTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/assetrequest/getMyTotal', {
await fetch('http://localhost:8080/api/assetrequest/getMyTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,61 @@ const SystemAnalyticsChart = () => {
const accessToken = sessionStorage.getItem('accessToken');

const fetchPromises = [
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/datascope/getTotal', {
await fetch('http://localhost:8080/api/datascope/getTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/dataScopeCount', {
await fetch('http://localhost:8080/api/user/dataScopeCount', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/countDevices', {
await fetch('http://localhost:8080/api/user/countDevices', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/asset/getTotalAssets', {
await fetch('http://localhost:8080/api/asset/getTotalAssets', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/taskCount', {
await fetch('http://localhost:8080/api/user/taskCount', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/task/totalTasks', {
await fetch('http://localhost:8080/api/task/totalTasks', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/supportrequest/getTotal', {
await fetch('http://localhost:8080/api/supportrequest/getTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/supportrequest/getMyTotal', {
await fetch('http://localhost:8080/api/supportrequest/getMyTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/assetrequest/getTotal', {
await fetch('http://localhost:8080/api/assetrequest/getTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
},
}),
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/assetrequest/getMyTotal', {
await fetch('http://localhost:8080/api/assetrequest/getMyTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + accessToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const TasksChart = () => {
const [chartInstance, setChartInstance] = useState(null);

useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/taskCount', {
fetch('http://localhost:8080/api/user/taskCount', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const useCurrentDataScope = () => {
const [dataScopeCount, setDataScopeCount] = useState(0);
const [myDataScopeCount, setMyDataScopeCount] = useState(0);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/datascope/getTotal', {
fetch('http://localhost:8080/api/datascope/getTotal', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -16,7 +16,7 @@ export const useCurrentDataScope = () => {
});
}, []);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/dataScopeCount', {
fetch('http://localhost:8080/api/user/dataScopeCount', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -30,7 +30,7 @@ export const useCurrentDataScope = () => {
const [assetCount, setAssetCount] = useState(0);
const [myAssets, setMyAssets] = useState([]);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/countDevices', {
fetch('http://localhost:8080/api/user/countDevices', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -41,7 +41,7 @@ export const useCurrentDataScope = () => {
});
}, []);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/getAllDevices', {
fetch('http://localhost:8080/api/user/getAllDevices', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -54,7 +54,7 @@ export const useCurrentDataScope = () => {

const [totalAssets, setTotalAssets] = useState(0);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/asset/getTotalAssets', {
fetch('http://localhost:8080/api/asset/getTotalAssets', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const useCurrentTasks = () => {
const [myTasks, setMyTasks] = useState([]);
const [totalTasks, setTotalTasks] = useState(0);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/taskCount', {
fetch('http://localhost:8080/api/user/taskCount', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -16,7 +16,7 @@ export const useCurrentTasks = () => {
});
}, []);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/getAllTasks', {
fetch('http://localhost:8080/api/user/getAllTasks', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -27,7 +27,7 @@ export const useCurrentTasks = () => {
});
}, []);
useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/task/totalTasks', {
fetch('http://localhost:8080/api/task/totalTasks', {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const CreateDataScopePopup = ({popupOpen, popupClose, onDsAdded}) => {
const ds_status = "Pending";
const datascope = {date_captured: currentDate, ds_description, ds_name, ds_status, user_email: selectedUsers};

fetch(`http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/datascope/checkName?dsname=${ds_name}`, {
fetch(`http://localhost:8080/api/datascope/checkName?dsname=${ds_name}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Expand All @@ -38,7 +38,7 @@ export const CreateDataScopePopup = ({popupOpen, popupClose, onDsAdded}) => {
console.log("DataScope name already exists");
} else {
//console.log(datascope);
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/datascope/addDs", {
fetch("http://localhost:8080/api/datascope/addDs", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -62,7 +62,7 @@ export const CreateDataScopePopup = ({popupOpen, popupClose, onDsAdded}) => {
};

useEffect(() => {
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/findNotDatCustodian", {
fetch("http://localhost:8080/api/user/findNotDatCustodian", {
method: "GET",
headers: {
"Content-Type": "application/json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const CreateDevicePopup = ({popupOpen, popupClose, onAssetCreated}) => {
//console.log(selectedUsers);
// console.log(asset);
popupClose()
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/asset/addAsset", {
fetch("http://localhost:8080/api/asset/addAsset", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -61,7 +61,7 @@ export const CreateDevicePopup = ({popupOpen, popupClose, onAssetCreated}) => {
})
}
useEffect(() => {
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/getAll", {
fetch("http://localhost:8080/api/user/getAll", {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const CreateRisk = ({ popupClose, popupOpen, onRiskAdded }) => {
const risk = {risk_name, impact_rating, probability_rating, risk_description, risk_status: "Open", suggested_mitigation, dataScope_id: datascope.value,};
//console.log(risk);

fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/risk/addRisk", {
fetch("http://localhost:8080/api/risk/addRisk", {
method:"POST",
headers:{"Content-Type":"application/json",
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const CreateTask = ({popupClose, popupOpen, onTaskAdded}) => {
};
//console.log(task)

fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/task/addTask", {
fetch("http://localhost:8080/api/task/addTask", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -68,7 +68,7 @@ export const CreateTask = ({popupClose, popupOpen, onTaskAdded}) => {
};

useEffect(() => {
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/getAll", {
fetch("http://localhost:8080/api/user/getAll", {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const CreateUserPopup = ({ popupOpen, popupClose, onUserAdded }) => {
return;
}

fetch(`http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/checkEmail?email=${email}`, {
fetch(`http://localhost:8080/api/user/checkEmail?email=${email}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Expand All @@ -37,7 +37,7 @@ export const CreateUserPopup = ({ popupOpen, popupClose, onUserAdded }) => {
console.log("User already exists");
} else {
//console.log(user);
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/add", {
fetch("http://localhost:8080/api/user/add", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down Expand Up @@ -66,7 +66,7 @@ export const CreateUserPopup = ({ popupOpen, popupClose, onUserAdded }) => {
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/randPass/generate", {
const response = await fetch("http://localhost:8080/api/randPass/generate", {
method: "GET",
headers: {"Content-Type":"application/json",
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -88,7 +88,7 @@ export const CreateUserPopup = ({ popupOpen, popupClose, onUserAdded }) => {
}, []);

useEffect(() => {
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/role/getRoleNames", {
fetch("http://localhost:8080/api/role/getRoleNames", {
method:"GET",
headers:{"Content-Type":"application/json",
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const ChangePassword = ({ popupClose, popupOpen }) => {

useEffect(() => {

fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/getEmail', {
fetch('http://localhost:8080/api/user/getEmail', {
method: "GET",
headers: {
"Content-Type": "application/json",
Expand Down Expand Up @@ -47,7 +47,7 @@ export const ChangePassword = ({ popupClose, popupOpen }) => {
}

try {
await fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/changePassword', {
await fetch('http://localhost:8080/api/user/changePassword', {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const EditAccessRequest = ({ access, popupClose, popupOpen, onArEdited }) => {
e.preventDefault();
//console.log(values)

fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/accessrequest/update/' + access.request_id, {
fetch('http://localhost:8080/api/accessrequest/update/' + access.request_id, {
method:"PUT",
headers:{"Content-Type":"application/json",
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const EditDataScopePopup = ({ datascope, popupOpen, popupClose, onDsEdite
});

// useEffect(() => {
// fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/findUsersNotInTask/" + task.task_id, {
// fetch("http://localhost:8080/api/user/findUsersNotInTask/" + task.task_id, {
// method: "GET",
// headers: {
// Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down Expand Up @@ -54,7 +54,7 @@ export const EditDataScopePopup = ({ datascope, popupOpen, popupClose, onDsEdite
//console.log(datascope);
//console.log(values);

fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/datascope/update/' + datascope.data_scope_id, {
fetch('http://localhost:8080/api/datascope/update/' + datascope.data_scope_id, {
method: 'POST',
headers: {
"Content-Type": 'application/json',
Expand All @@ -69,7 +69,7 @@ export const EditDataScopePopup = ({ datascope, popupOpen, popupClose, onDsEdite
};

useEffect(() => {
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/dataScopeRole/rolesByDataScopeId/' + datascope.data_scope_id, {
fetch('http://localhost:8080/api/dataScopeRole/rolesByDataScopeId/' + datascope.data_scope_id, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + sessionStorage.getItem('accessToken')
Expand All @@ -85,7 +85,7 @@ export const EditDataScopePopup = ({ datascope, popupOpen, popupClose, onDsEdite
e.preventDefault();
const newRoleData = { datascope: datascope.data_scope_id, role_description: newRole.roledescription, role_type: newRole.role };

fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/dataScopeRole/addDataScopeRole', {
fetch('http://localhost:8080/api/dataScopeRole/addDataScopeRole', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions frontend/infosafe_frontend/src/components/Edit/EditDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const EditDevice = ({ asset, popupClose, popupOpen, onAssesEdited }) => {
}

//console.log(request);
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/asset/update/' + asset.asset_id, {
fetch('http://localhost:8080/api/asset/update/' + asset.asset_id, {
method:"PUT",
headers:{"Content-Type":"application/json",
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand All @@ -83,7 +83,7 @@ const EditDevice = ({ asset, popupClose, popupOpen, onAssesEdited }) => {
}

useEffect(() => {
fetch("http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/user/findUserNotAssigned/" + asset.asset_id, {
fetch("http://localhost:8080/api/user/findUserNotAssigned/" + asset.asset_id, {
method: "GET",
headers: {
Authorization: "Bearer " + sessionStorage.getItem('accessToken')
Expand Down
2 changes: 1 addition & 1 deletion frontend/infosafe_frontend/src/components/Edit/EditRisk.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const EditRisk = ({risk, popupClose, popupOpen, onRiskEdited}) => {
e.preventDefault();

console.log(values)
fetch('http://ec2-52-91-180-105.compute-1.amazonaws.com:8080/api/risk/update/' + risk.risk_id, {
fetch('http://localhost:8080/api/risk/update/' + risk.risk_id, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
Loading

0 comments on commit dd7a670

Please sign in to comment.