create-myexam-app 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/projects/SCMS/backend/.env +2 -2
- package/projects/SCMS/backend/config/db.js +12 -0
- package/projects/SCMS/backend/controllers/authController.js +90 -0
- package/projects/SCMS/backend/controllers/deliveryController.js +79 -0
- package/projects/SCMS/backend/controllers/productController.js +74 -0
- package/projects/SCMS/backend/controllers/reportsController.js +77 -0
- package/projects/SCMS/backend/controllers/shipmentController.js +80 -0
- package/projects/SCMS/backend/controllers/supplierController.js +58 -0
- package/projects/SCMS/backend/middleware/auth.js +32 -0
- package/projects/SCMS/backend/models/User.js +28 -0
- package/projects/SCMS/backend/models/delivery.js +33 -0
- package/projects/SCMS/backend/models/product.js +43 -0
- package/projects/SCMS/backend/models/shipment.js +34 -0
- package/projects/SCMS/backend/models/supplier.js +36 -0
- package/projects/SCMS/backend/package-lock.json +2190 -778
- package/projects/SCMS/backend/package.json +23 -23
- package/projects/SCMS/backend/routes/SupplierRoutes.js +15 -0
- package/projects/SCMS/backend/routes/authRoutes.js +11 -0
- package/projects/SCMS/backend/routes/deliveryRoutes.js +18 -0
- package/projects/SCMS/backend/routes/productRoutes.js +15 -0
- package/projects/SCMS/backend/routes/protectedRoutes.js +10 -0
- package/projects/SCMS/backend/routes/reportsRoutes.js +8 -0
- package/projects/SCMS/backend/routes/shipmentRoutes.js +18 -0
- package/projects/SCMS/backend/server.js +28 -8
- package/projects/SCMS/frontend/index.html +1 -1
- package/projects/SCMS/frontend/package-lock.json +781 -152
- package/projects/SCMS/frontend/package.json +5 -1
- package/projects/SCMS/frontend/src/App.jsx +28 -115
- package/projects/SCMS/frontend/src/components/DashboardLayout.jsx +103 -0
- package/projects/SCMS/frontend/src/components/ProtectedRoute.jsx +30 -0
- package/projects/SCMS/frontend/src/index.css +110 -107
- package/projects/SCMS/frontend/src/pages/DashboardHome.jsx +34 -0
- package/projects/SCMS/frontend/src/pages/Delivery.jsx +183 -0
- package/projects/SCMS/frontend/src/pages/Login.jsx +81 -0
- package/projects/SCMS/frontend/src/pages/Profile.jsx +62 -0
- package/projects/SCMS/frontend/src/pages/Register.jsx +110 -0
- package/projects/SCMS/frontend/src/pages/Reports.jsx +94 -0
- package/projects/SCMS/frontend/src/pages/Shipment.jsx +182 -0
- package/projects/SCMS/frontend/src/pages/Supplier.jsx +165 -0
- package/projects/SCMS/frontend/vite.config.js +2 -2
- package/projects/SCMS/backend/db/connectDB.js +0 -11
- package/projects/SCMS/frontend/public/icons.svg +0 -24
- package/projects/SCMS/frontend/src/App.css +0 -184
- package/projects/SCMS/frontend/src/assets/hero.png +0 -0
- package/projects/SCMS/frontend/src/assets/react.svg +0 -1
- package/projects/SCMS/frontend/src/assets/vite.svg +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "backend",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"license": "
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"nodemon": "^3.1.
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "blueprint-backend",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Blueprint API — Node, Express, MongoDB",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "nodemon server.js",
|
|
8
|
+
"start": "node server.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"bcrypt": "^5.1.1",
|
|
14
|
+
"cors": "^2.8.5",
|
|
15
|
+
"dotenv": "^16.4.7",
|
|
16
|
+
"express": "^4.21.2",
|
|
17
|
+
"jsonwebtoken": "^9.0.2",
|
|
18
|
+
"mongoose": "^8.9.3"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"nodemon": "^3.1.9"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const express = require('express')
|
|
2
|
+
|
|
3
|
+
const router = express.Router()
|
|
4
|
+
|
|
5
|
+
// const {protect} =require('../middleware/auth')
|
|
6
|
+
const {addsupplier,getsupplierbyid,getsupplier,updatesupplier,deletesupplier} = require('../controllers/supplierController')
|
|
7
|
+
|
|
8
|
+
// router.use(protect)
|
|
9
|
+
router.post('/addsupplier',addsupplier)
|
|
10
|
+
router.get('/getsupplier',getsupplier)
|
|
11
|
+
router.get('/getsupplierbyid/:id',getsupplierbyid)
|
|
12
|
+
router.put('/updatesupplier/:id',updatesupplier)
|
|
13
|
+
router.delete('/deletesupplier/:id',deletesupplier)
|
|
14
|
+
|
|
15
|
+
module.exports =router
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const { register, login, getMe } = require('../controllers/authController');
|
|
3
|
+
const { protect } = require('../middleware/auth');
|
|
4
|
+
|
|
5
|
+
const router = express.Router();
|
|
6
|
+
|
|
7
|
+
router.post('/register', register);
|
|
8
|
+
router.post('/login', login);
|
|
9
|
+
router.get('/me', protect, getMe);
|
|
10
|
+
|
|
11
|
+
module.exports = router;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const {
|
|
3
|
+
addDelivery,
|
|
4
|
+
getDeliveries,
|
|
5
|
+
getDeliveryById,
|
|
6
|
+
updateDelivery,
|
|
7
|
+
deleteDelivery,
|
|
8
|
+
} = require('../controllers/deliveryController');
|
|
9
|
+
|
|
10
|
+
const router = express.Router();
|
|
11
|
+
|
|
12
|
+
router.post('/adddelivery', addDelivery);
|
|
13
|
+
router.get('/getdeliveries', getDeliveries);
|
|
14
|
+
router.get('/getdeliverybyid/:id', getDeliveryById);
|
|
15
|
+
router.put('/updatedelivery/:id', updateDelivery);
|
|
16
|
+
router.delete('/deletedelivery/:id', deleteDelivery);
|
|
17
|
+
|
|
18
|
+
module.exports = router;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const express = require("express")
|
|
2
|
+
const router = express.Router()
|
|
3
|
+
const { protect } = require('../middleware/auth');
|
|
4
|
+
const{addproduct,getproduct,getproductbyid,deleteproduct,updateproduct} = require('../controllers/productController')
|
|
5
|
+
|
|
6
|
+
router.use(protect)
|
|
7
|
+
|
|
8
|
+
router.post('/addproduct',addproduct)
|
|
9
|
+
router.get('/getproduct',getproduct)
|
|
10
|
+
router.get('/getproductbyid/:id',getproductbyid)
|
|
11
|
+
router.delete('/deleteproduct/:id',deleteproduct)
|
|
12
|
+
router.put('/updateproduct/:id',updateproduct)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
module.exports = router
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const router = express.Router();
|
|
3
|
+
const { protect } = require('../middleware/auth');
|
|
4
|
+
|
|
5
|
+
// GET /api/protected - simple protected endpoint
|
|
6
|
+
router.get('/', protect, (req, res) => {
|
|
7
|
+
res.json({ message: 'Protected content', user: req.user });
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
module.exports = router;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const {
|
|
3
|
+
addShipment,
|
|
4
|
+
getShipments,
|
|
5
|
+
getShipmentById,
|
|
6
|
+
updateShipment,
|
|
7
|
+
deleteShipment,
|
|
8
|
+
} = require('../controllers/shipmentController');
|
|
9
|
+
|
|
10
|
+
const router = express.Router();
|
|
11
|
+
|
|
12
|
+
router.post('/addshipment', addShipment);
|
|
13
|
+
router.get('/getshipments', getShipments);
|
|
14
|
+
router.get('/getshipmentbyid/:id', getShipmentById);
|
|
15
|
+
router.put('/updateshipment/:id', updateShipment);
|
|
16
|
+
router.delete('/deleteshipment/:id', deleteShipment);
|
|
17
|
+
|
|
18
|
+
module.exports = router;
|
|
@@ -1,15 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const cors = require('cors');
|
|
3
|
+
|
|
4
|
+
const connectDB = require('./config/db');
|
|
5
|
+
|
|
6
|
+
const authRoutes = require('./routes/authRoutes');
|
|
7
|
+
|
|
8
|
+
const productRoutes = require('./routes/productRoutes');
|
|
9
|
+
const SupplierRoutes = require('./routes/SupplierRoutes');
|
|
10
|
+
const shipmentRoutes = require('./routes/shipmentRoutes');
|
|
11
|
+
const deliveryRoutes = require('./routes/deliveryRoutes');
|
|
12
|
+
const reportsRoutes = require('./routes/reportsRoutes');
|
|
13
|
+
const protectedRoutes = require('./routes/protectedRoutes');
|
|
5
14
|
|
|
6
15
|
const app = express();
|
|
7
|
-
const PORT = process.env.PORT || 5000
|
|
8
|
-
connectDB()
|
|
9
16
|
|
|
10
17
|
app.use(cors());
|
|
11
18
|
app.use(express.json());
|
|
19
|
+
connectDB();
|
|
20
|
+
|
|
21
|
+
app.use('/api/product', productRoutes);
|
|
22
|
+
app.use('/api/supplier', SupplierRoutes);
|
|
23
|
+
app.use('/api/auth', authRoutes);
|
|
12
24
|
|
|
25
|
+
app.use('/api/shipment', shipmentRoutes);
|
|
26
|
+
app.use('/api/delivery', deliveryRoutes);
|
|
27
|
+
app.use('/api/reports', reportsRoutes);
|
|
28
|
+
app.use('/api/protected', protectedRoutes);
|
|
29
|
+
|
|
30
|
+
const PORT = 5001;
|
|
13
31
|
app.listen(PORT, () => {
|
|
14
|
-
|
|
15
|
-
});
|
|
32
|
+
console.log(`Server running on http://localhost:${PORT}`);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>
|
|
7
|
+
<title>SCMS — Supply Chain Management</title>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<div id="root"></div>
|