krispdev-business 1.0.0
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/Dev-Business/.vscode/settings.json +3 -0
- package/Dev-Business/backend-project/config/db.js +16 -0
- package/Dev-Business/backend-project/controllers/authController.js +41 -0
- package/Dev-Business/backend-project/controllers/carController.js +62 -0
- package/Dev-Business/backend-project/controllers/packageController.js +49 -0
- package/Dev-Business/backend-project/controllers/paymentController.js +63 -0
- package/Dev-Business/backend-project/controllers/reportController.js +129 -0
- package/Dev-Business/backend-project/controllers/serviceController.js +155 -0
- package/Dev-Business/backend-project/middleware/auth.js +16 -0
- package/Dev-Business/backend-project/package-lock.json +1507 -0
- package/Dev-Business/backend-project/package.json +21 -0
- package/Dev-Business/backend-project/routes/authRoutes.js +10 -0
- package/Dev-Business/backend-project/routes/carRoutes.js +11 -0
- package/Dev-Business/backend-project/routes/packageRoutes.js +11 -0
- package/Dev-Business/backend-project/routes/paymentRoutes.js +10 -0
- package/Dev-Business/backend-project/routes/reportRoutes.js +11 -0
- package/Dev-Business/backend-project/routes/serviceRoutes.js +19 -0
- package/Dev-Business/backend-project/server.js +72 -0
- package/Dev-Business/frontend-project/README.md +18 -0
- package/Dev-Business/frontend-project/eslint.config.js +21 -0
- package/Dev-Business/frontend-project/index.html +14 -0
- package/Dev-Business/frontend-project/package-lock.json +3655 -0
- package/Dev-Business/frontend-project/package.json +34 -0
- package/Dev-Business/frontend-project/postcss.config.js +6 -0
- package/Dev-Business/frontend-project/public/favicon.svg +1 -0
- package/Dev-Business/frontend-project/public/icons.svg +24 -0
- package/Dev-Business/frontend-project/src/App.css +184 -0
- package/Dev-Business/frontend-project/src/App.jsx +84 -0
- package/Dev-Business/frontend-project/src/assets/hero.png +0 -0
- package/Dev-Business/frontend-project/src/assets/react.svg +1 -0
- package/Dev-Business/frontend-project/src/assets/vite.svg +1 -0
- package/Dev-Business/frontend-project/src/components/CarForm.jsx +146 -0
- package/Dev-Business/frontend-project/src/components/DailyReport.jsx +264 -0
- package/Dev-Business/frontend-project/src/components/Dashboard.jsx +153 -0
- package/Dev-Business/frontend-project/src/components/Login.jsx +163 -0
- package/Dev-Business/frontend-project/src/components/Navbar.jsx +99 -0
- package/Dev-Business/frontend-project/src/components/Navibar.jsx +100 -0
- package/Dev-Business/frontend-project/src/components/PaymentForm.jsx +211 -0
- package/Dev-Business/frontend-project/src/components/ServiceRecord.jsx +384 -0
- package/Dev-Business/frontend-project/src/index.css +155 -0
- package/Dev-Business/frontend-project/src/main.jsx +10 -0
- package/Dev-Business/frontend-project/src/services/api.js +23 -0
- package/Dev-Business/frontend-project/tailwind.config.js +31 -0
- package/Dev-Business/frontend-project/vite.config.js +15 -0
- package/package.json +17 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cwsms-backend",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"express": "^4.18.2",
|
|
7
|
+
"mysql2": "^3.6.0",
|
|
8
|
+
"dotenv": "^16.3.1",
|
|
9
|
+
"cors": "^2.8.5",
|
|
10
|
+
"express-session": "^1.17.3",
|
|
11
|
+
"bcryptjs": "^2.4.3"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "nodemon server.js",
|
|
15
|
+
"dev": "nodemon server.js"
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"nodemon": "^3.0.1"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { login, logout, checkAuth } from '../controllers/authController.js';
|
|
3
|
+
|
|
4
|
+
const router = express.Router();
|
|
5
|
+
|
|
6
|
+
router.post('/login', login);
|
|
7
|
+
router.post('/logout', logout);
|
|
8
|
+
router.get('/check', checkAuth);
|
|
9
|
+
|
|
10
|
+
export default router;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { createCar, getAllCars, getCarByPlate } from '../controllers/carController.js';
|
|
3
|
+
import { requireAuth } from '../middleware/auth.js';
|
|
4
|
+
|
|
5
|
+
const router = express.Router();
|
|
6
|
+
|
|
7
|
+
router.post('/', requireAuth, createCar); // INSERT Car
|
|
8
|
+
router.get('/', requireAuth, getAllCars); // RETRIEVE all cars
|
|
9
|
+
router.get('/:plateNumber', requireAuth, getCarByPlate); // RETRIEVE one car
|
|
10
|
+
|
|
11
|
+
export default router;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { createPackage, getAllPackages, getPackageById } from '../controllers/packageController.js';
|
|
3
|
+
import { requireAuth } from '../middleware/auth.js';
|
|
4
|
+
|
|
5
|
+
const router = express.Router();
|
|
6
|
+
|
|
7
|
+
router.post('/', requireAuth, createPackage); // INSERT Package
|
|
8
|
+
router.get('/', requireAuth, getAllPackages); // RETRIEVE all packages
|
|
9
|
+
router.get('/:id', requireAuth, getPackageById); // RETRIEVE one package
|
|
10
|
+
|
|
11
|
+
export default router;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { createPayment, getPaymentByRecord } from '../controllers/paymentController.js';
|
|
3
|
+
import { requireAuth } from '../middleware/auth.js';
|
|
4
|
+
|
|
5
|
+
const router = express.Router();
|
|
6
|
+
|
|
7
|
+
router.post('/', requireAuth, createPayment); // INSERT Payment
|
|
8
|
+
router.get('/:recordNumber', requireAuth, getPaymentByRecord); // RETRIEVE payment
|
|
9
|
+
|
|
10
|
+
export default router;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { getDailyReport, generateBill, getRevenueReport } from '../controllers/reportController.js';
|
|
3
|
+
import { requireAuth } from '../middleware/auth.js';
|
|
4
|
+
|
|
5
|
+
const router = express.Router();
|
|
6
|
+
|
|
7
|
+
router.get('/daily', requireAuth, getDailyReport);
|
|
8
|
+
router.get('/bill/:recordNumber', requireAuth, generateBill);
|
|
9
|
+
router.get('/revenue', requireAuth, getRevenueReport);
|
|
10
|
+
|
|
11
|
+
export default router;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import {
|
|
3
|
+
createService, // INSERT
|
|
4
|
+
getAllServices, // RETRIEVE
|
|
5
|
+
getServiceById, // RETRIEVE one
|
|
6
|
+
updateService, // UPDATE
|
|
7
|
+
deleteService // DELETE
|
|
8
|
+
} from '../controllers/serviceController.js';
|
|
9
|
+
import { requireAuth } from '../middleware/auth.js';
|
|
10
|
+
|
|
11
|
+
const router = express.Router();
|
|
12
|
+
|
|
13
|
+
router.post('/', requireAuth, createService); // INSERT
|
|
14
|
+
router.get('/', requireAuth, getAllServices); // RETRIEVE all
|
|
15
|
+
router.get('/:recordNumber', requireAuth, getServiceById); // RETRIEVE one
|
|
16
|
+
router.put('/:recordNumber', requireAuth, updateService);
|
|
17
|
+
router.delete('/:recordNumber', requireAuth, deleteService); // DELETE
|
|
18
|
+
|
|
19
|
+
export default router;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import session from 'express-session';
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import pool from './config/db.js';
|
|
6
|
+
|
|
7
|
+
// Import routes
|
|
8
|
+
import authRoutes from './routes/authRoutes.js';
|
|
9
|
+
import carRoutes from './routes/carRoutes.js';
|
|
10
|
+
import packageRoutes from './routes/packageRoutes.js';
|
|
11
|
+
import serviceRoutes from './routes/serviceRoutes.js';
|
|
12
|
+
import paymentRoutes from './routes/paymentRoutes.js';
|
|
13
|
+
import reportRoutes from './routes/reportRoutes.js';
|
|
14
|
+
|
|
15
|
+
dotenv.config();
|
|
16
|
+
|
|
17
|
+
const app = express();
|
|
18
|
+
const PORT = process.env.PORT || 5000;
|
|
19
|
+
|
|
20
|
+
app.use(cors({
|
|
21
|
+
origin: 'http://localhost:5173',
|
|
22
|
+
credentials: true
|
|
23
|
+
}));
|
|
24
|
+
app.use(express.json());
|
|
25
|
+
app.use(express.urlencoded({ extended: true }));
|
|
26
|
+
app.use(session({
|
|
27
|
+
secret: process.env.SESSION_SECRET,
|
|
28
|
+
resave: false,
|
|
29
|
+
saveUninitialized: false,
|
|
30
|
+
cookie: {
|
|
31
|
+
secure: false,
|
|
32
|
+
maxAge: 8 * 60 * 60 * 1000
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
// Routes
|
|
37
|
+
app.use('/api/auth', authRoutes);
|
|
38
|
+
app.use('/api/cars', carRoutes);
|
|
39
|
+
app.use('/api/packages', packageRoutes);
|
|
40
|
+
app.use('/api/services', serviceRoutes);
|
|
41
|
+
app.use('/api/payments', paymentRoutes);
|
|
42
|
+
app.use('/api/reports', reportRoutes);
|
|
43
|
+
|
|
44
|
+
// Test database connection
|
|
45
|
+
const testDB = async () => {
|
|
46
|
+
try {
|
|
47
|
+
const connection = await pool.getConnection();
|
|
48
|
+
console.log('✅ MySQL connected successfully');
|
|
49
|
+
connection.release();
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('❌ MySQL connection failed:', error.message);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
testDB();
|
|
57
|
+
|
|
58
|
+
app.listen(PORT, () => {
|
|
59
|
+
console.log(`🚀 Server running on http://localhost:${PORT}`);
|
|
60
|
+
console.log(`📋 Available endpoints:`);
|
|
61
|
+
console.log(` amandine is running`);
|
|
62
|
+
console.log(` POST /api/auth/logout`);
|
|
63
|
+
console.log(` POST /api/cars (Insert Car)`);
|
|
64
|
+
console.log(` POST /api/packages (Insert Package)`);
|
|
65
|
+
console.log(` POST /api/services (Insert Service)`);
|
|
66
|
+
console.log(` GET /api/services (Retrieve Services)`);
|
|
67
|
+
console.log(` PUT /api/services/:id (Update Service)`);
|
|
68
|
+
console.log(` DELETE /api/services/:id (Delete Service)`);
|
|
69
|
+
console.log(` POST /api/payments (Insert Payment)`);
|
|
70
|
+
console.log(` GET /api/reports/daily (Daily Report)`);
|
|
71
|
+
console.log(` GET /api/reports/bill/:id (Generate Bill)`);
|
|
72
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# React + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.
|
|
13
|
+
|
|
14
|
+
Note: This will impact Vite dev & build performances.
|
|
15
|
+
|
|
16
|
+
## Expanding the ESLint configuration
|
|
17
|
+
|
|
18
|
+
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
globalIgnores(['dist']),
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{js,jsx}'],
|
|
11
|
+
extends: [
|
|
12
|
+
js.configs.recommended,
|
|
13
|
+
reactHooks.configs.flat.recommended,
|
|
14
|
+
reactRefresh.configs.vite,
|
|
15
|
+
],
|
|
16
|
+
languageOptions: {
|
|
17
|
+
globals: globals.browser,
|
|
18
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
])
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>SmartPark - Car Wash Management System</title>
|
|
8
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|