Skip to content

Commit

Permalink
db updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Avinash905 committed Apr 27, 2023
1 parent f26d810 commit c540f24
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 34 deletions.
6 changes: 3 additions & 3 deletions client/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/static/css/main.0ad436e8.css",
"main.js": "/static/js/main.83ef42fb.js",
"main.js": "/static/js/main.bd9eb2f7.js",
"static/media/heroimg.jpg": "/static/media/heroimg.8bbd2437f7c9d842026c.jpg",
"static/media/aboutimg.jpg": "/static/media/aboutimg.af2db4b9f307d04f8745.jpg",
"index.html": "/index.html",
"main.0ad436e8.css.map": "/static/css/main.0ad436e8.css.map",
"main.83ef42fb.js.map": "/static/js/main.83ef42fb.js.map"
"main.bd9eb2f7.js.map": "/static/js/main.bd9eb2f7.js.map"
},
"entrypoints": [
"static/css/main.0ad436e8.css",
"static/js/main.83ef42fb.js"
"static/js/main.bd9eb2f7.js"
]
}
2 changes: 1 addition & 1 deletion client/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>HealthBooker</title><script defer="defer" src="/static/js/main.83ef42fb.js"></script><link href="/static/css/main.0ad436e8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>HealthBooker</title><script defer="defer" src="/static/js/main.bd9eb2f7.js"></script><link href="/static/css/main.0ad436e8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1 change: 0 additions & 1 deletion client/build/static/js/main.83ef42fb.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/build/static/js/main.bd9eb2f7.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion client/src/components/AdminDoctors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const AdminDoctors = () => {
getAllDoctors();
}, []);

console.log(doctors);
return (
<>
{loading ? (
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const Users = () => {
dispatch(setLoading(true));
const temp = await fetchData(`/user/getallusers`);
setUsers(temp);
console.log("🚀 ~ file: Users.jsx:23 ~ getAllUsers ~ temp:", temp);
dispatch(setLoading(false));
} catch (error) {}
};
Expand Down
9 changes: 2 additions & 7 deletions client/src/middleware/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ export const Public = ({ children }) => {
};

export const Admin = ({ children }) => {
const { userId } = jwtDecode(localStorage.getItem("token"));
const user = jwtDecode(localStorage.getItem("token"));

const getUser = async (e) => {
const temp = await fetchData(`/user/getuser/${userId}`);
return temp.isAdmin;
};

if (getUser()) {
if (user.isAdmin) {
return children;
}
return (
Expand Down
17 changes: 12 additions & 5 deletions db/conn.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
const { MongoClient } = require("mongodb");
const mongoose = require("mongoose");
require("dotenv").config();
mongoose.set("strictQuery", false);
require("dotenv").config();

const mongodbconn = mongoose
.connect(process.env.MONGO_URI)
.then(() => {})
const client = mongoose
.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
})
.then(() => {
console.log("DB connected");
})
.catch((error) => {
console.log("Error: ", error);

return error;
});

module.exports = mongodbconn;
module.exports = client;
85 changes: 72 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dotenv": "^16.0.3",
"express": "^4.18.2",
"jsonwebtoken": "^9.0.0",
"mongodb": "^5.3.0",
"mongoose": "^6.9.0"
}
}

0 comments on commit c540f24

Please sign in to comment.