create-myexam-app 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.
Files changed (46) hide show
  1. package/index.js +65 -0
  2. package/package.json +22 -0
  3. package/projects/parking managementt system/Backend/.env +3 -0
  4. package/projects/parking managementt system/Backend/controllers/CarController.js +43 -0
  5. package/projects/parking managementt system/Backend/controllers/ParkingRecordController.js +42 -0
  6. package/projects/parking managementt system/Backend/controllers/ParkingSlotController.js +42 -0
  7. package/projects/parking managementt system/Backend/controllers/PaymentController.js +42 -0
  8. package/projects/parking managementt system/Backend/controllers/UserController.js +71 -0
  9. package/projects/parking managementt system/Backend/db/connectDB.js +11 -0
  10. package/projects/parking managementt system/Backend/models/CarModels.js +9 -0
  11. package/projects/parking managementt system/Backend/models/ParkingRecordModelss.js +10 -0
  12. package/projects/parking managementt system/Backend/models/ParkingSlotModels.js +7 -0
  13. package/projects/parking managementt system/Backend/models/PaymentModels.js +9 -0
  14. package/projects/parking managementt system/Backend/models/UserModels.js +9 -0
  15. package/projects/parking managementt system/Backend/package-lock.json +1526 -0
  16. package/projects/parking managementt system/Backend/package.json +23 -0
  17. package/projects/parking managementt system/Backend/routes/CarRoutes.js +11 -0
  18. package/projects/parking managementt system/Backend/routes/ParkingRecordRoutes.js +9 -0
  19. package/projects/parking managementt system/Backend/routes/ParkingSlotRoutes.js +11 -0
  20. package/projects/parking managementt system/Backend/routes/PaymentRoutes.js +10 -0
  21. package/projects/parking managementt system/Backend/routes/UserRoutes.js +17 -0
  22. package/projects/parking managementt system/Backend/server.js +27 -0
  23. package/projects/parking managementt system/frontend/README.md +16 -0
  24. package/projects/parking managementt system/frontend/eslint.config.js +21 -0
  25. package/projects/parking managementt system/frontend/index.html +13 -0
  26. package/projects/parking managementt system/frontend/package-lock.json +3033 -0
  27. package/projects/parking managementt system/frontend/package.json +31 -0
  28. package/projects/parking managementt system/frontend/public/favicon.svg +1 -0
  29. package/projects/parking managementt system/frontend/public/icons.svg +24 -0
  30. package/projects/parking managementt system/frontend/src/App.css +184 -0
  31. package/projects/parking managementt system/frontend/src/App.jsx +34 -0
  32. package/projects/parking managementt system/frontend/src/assets/hero.png +0 -0
  33. package/projects/parking managementt system/frontend/src/assets/react.svg +1 -0
  34. package/projects/parking managementt system/frontend/src/assets/vite.svg +1 -0
  35. package/projects/parking managementt system/frontend/src/components/Navbar.jsx +27 -0
  36. package/projects/parking managementt system/frontend/src/index.css +1 -0
  37. package/projects/parking managementt system/frontend/src/main.jsx +10 -0
  38. package/projects/parking managementt system/frontend/src/pages/Cars.jsx +116 -0
  39. package/projects/parking managementt system/frontend/src/pages/Dashboard.jsx +45 -0
  40. package/projects/parking managementt system/frontend/src/pages/Login.jsx +63 -0
  41. package/projects/parking managementt system/frontend/src/pages/ParkingRecord.jsx +168 -0
  42. package/projects/parking managementt system/frontend/src/pages/ParkingSlot.jsx +102 -0
  43. package/projects/parking managementt system/frontend/src/pages/Payment.jsx +101 -0
  44. package/projects/parking managementt system/frontend/src/pages/Register.jsx +65 -0
  45. package/projects/parking managementt system/frontend/src/pages/Report.jsx +98 -0
  46. package/projects/parking managementt system/frontend/vite.config.js +10 -0
package/index.js ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+ const readline = require('readline')
6
+
7
+ const rl = readline.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ })
11
+
12
+ console.log('[2] Hospital Management System')
13
+ console.log('[3] libray system management system')
14
+ console.log('[4] SmartPark - Parking Management System')
15
+ console.log('[5] School Fee Management System')
16
+
17
+ rl.question('\nPick (1-3): ', (answer) => {
18
+
19
+ // change these folder names to match YOUR folders
20
+ const projects = {
21
+ '1': 'Hospital Management System',
22
+ '2': 'libray system management system',
23
+ '3': 'SmartPark - Parking Management System',
24
+ '4':'School Fee Management System',
25
+
26
+ }
27
+
28
+ const chosen = projects[answer]
29
+
30
+ if (!chosen) {
31
+ console.log('Invalid choice!')
32
+ rl.close()
33
+ return
34
+ }
35
+
36
+ const src = path.join(__dirname, 'projects', chosen)
37
+ const dest = path.join(process.cwd(), chosen)
38
+
39
+ copyFolder(src, dest)
40
+
41
+ console.log(`\n Done! Now run:`)
42
+ console.log(` cd ${chosen}/frontend-project`)
43
+ console.log(` npm install`)
44
+ console.log(` npm run dev\n`)
45
+
46
+ rl.close()
47
+ })
48
+
49
+ function copyFolder(src, dest) {
50
+ fs.mkdirSync(dest, { recursive: true })
51
+ const entries = fs.readdirSync(src, { withFileTypes: true })
52
+
53
+ for (let entry of entries) {
54
+ const srcPath = path.join(src, entry.name)
55
+ const destPath = path.join(dest, entry.name)
56
+
57
+ if (entry.name === 'node_modules') continue
58
+
59
+ if (entry.isDirectory()) {
60
+ copyFolder(srcPath, destPath)
61
+ } else {
62
+ fs.copyFileSync(srcPath, destPath)
63
+ }
64
+ }
65
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+
3
+ "name": "create-myexam-app",
4
+
5
+ "version": "1.0.0",
6
+
7
+ "description": "My exam projects",
8
+
9
+ "main": "index.js",
10
+
11
+ "bin": {
12
+
13
+
14
+ "create-myexam-app": "./index.js"
15
+
16
+ },
17
+ "files": [
18
+ "index.js",
19
+ "projects/"
20
+ ],
21
+ "license": "ISC"
22
+ }
@@ -0,0 +1,3 @@
1
+ PORT = 5000
2
+
3
+ MONGO_URI = mongodb://localhost:27017/ghost
@@ -0,0 +1,43 @@
1
+ import Car from "../models/CarModels.js"
2
+
3
+ export const carCreate = async (req,res) => {
4
+ try{
5
+ const car = await Car.create(req.body);
6
+ res.status(201).json(car);
7
+ }catch (error) {
8
+ res.status(500).json({message: error.message});
9
+ }
10
+ };
11
+
12
+ //read
13
+
14
+ export const getAllCars = async (req,res) => {
15
+ try{
16
+ const car = await Car.find();
17
+ res.status(201).json(car);
18
+ }catch(error){
19
+ res.status(500).json({message:error.message});
20
+ }
21
+ };
22
+
23
+ //update
24
+
25
+ export const updateCar = async(req, res) => {
26
+ try{
27
+ const updateCar = await Car.findByIdAndUpdate(req.params.id, req.body, {new:true});
28
+ res.status(201).json(updateCar);
29
+ }catch(error){
30
+ res.status(500).json({message:error.message});
31
+ }
32
+ };
33
+
34
+ //delete
35
+
36
+ export const deleteCar = async (req,res) => {
37
+ try{
38
+ await Car.findByIdAndDelete(req.params.id);
39
+ res.status(201).json({message:"car deleted successfully"});
40
+ }catch(error){
41
+ res.status(500).json({message:error.message});
42
+ }
43
+ };
@@ -0,0 +1,42 @@
1
+ import ParkingRecord from "../models/ParkingRecordModelss.js";
2
+
3
+ export const parkingRecordCreate = async (req,res) => {
4
+ try{
5
+ const parkingRecord = await ParkingRecord.create(req.body);
6
+ res.status(201).json(parkingRecord);
7
+ }catch(error){
8
+ res.status(500).json({message:error.message});
9
+ }
10
+ };
11
+
12
+ //read
13
+ export const getParkingRecord = async (req,res) => {
14
+ try{
15
+ const parkingRecord = await ParkingRecord.find();
16
+ res.status(200).json(parkingRecord);
17
+ }catch(error){
18
+ res.status(500).json({message:error.message});
19
+ }
20
+ };
21
+
22
+ //update
23
+
24
+ export const updateParkingRecord = async (req,res) => {
25
+ try{
26
+ const parkingRecord = await ParkingRecord.findByIdAndUpdate(req.params.id, req.body, {new:true});
27
+ res.status(200).json(parkingRecord);
28
+ }catch(error){
29
+ res.status(500).json({message:error.message});
30
+ }
31
+ };
32
+
33
+ //delete
34
+
35
+ export const deleteParkingRecord = async (req,res) => {
36
+ try{
37
+ const parkingRecord = await ParkingRecord.findByIdAndDelete(req.params.id);
38
+ res.status(200).json({message:"car deleted successfully"});
39
+ }catch(error){
40
+ res.status(500).json({message:error.message});
41
+ }
42
+ };
@@ -0,0 +1,42 @@
1
+ import { json } from "express";
2
+ import ParkingSlot from "../models/ParkingSlotModels.js";
3
+
4
+ export const parkingSlotCreate = async (req,res) => {
5
+ try{
6
+
7
+ const parkingSlot = await ParkingSlot.create(req.body);
8
+ res.status(201).json(parkingSlot);
9
+ }catch (error){
10
+ res.status(500).json({message:error.message});
11
+ }
12
+ };
13
+ //read
14
+
15
+ export const getParkingSlot = async (req,res) => {
16
+ try{
17
+ const parkingSlot = await ParkingSlot.find();
18
+ res.status(200).json(parkingSlot);
19
+ }catch(error){
20
+ res.status(500).json({message:error.message});
21
+ }
22
+ };
23
+
24
+ //update
25
+ export const updatepakingSlot = async (req,res) =>{
26
+ try{
27
+ const parkingSlot = await ParkingSlot.findByIdAndUpdate(req.params.id, req.body, {new:true});
28
+ res.status(200).json(pakingSlot);
29
+ }catch(error){
30
+ res.status(500).json({message:error.message});
31
+ }
32
+ };
33
+
34
+ //delete
35
+ export const deleteParkingSlot = async (req,res) => {
36
+ try{
37
+ const parkingSlot = await ParkingSlot.findByIdAndDelete(req.params.id);
38
+ res.status(200).json({message:"parking slot deleted"});
39
+ }catch(error){
40
+ res.status(500).json({message:error.message});
41
+ }
42
+ };
@@ -0,0 +1,42 @@
1
+ import Payment from "../models/PaymentModels.js";
2
+
3
+ export const paymentCreate = async (req,res) =>{
4
+ try{
5
+ const payment = await Payment.create (req.body);
6
+ res.status(200).json(payment);
7
+ }catch(error){
8
+ res.status(500).json({message:error.message});
9
+ }
10
+ };
11
+ //read
12
+
13
+ export const getPayment = async (req,res) => {
14
+ try{
15
+ const payment = await Payment.find();
16
+ res.status(200).json(payment);
17
+ }catch(error){
18
+ res.status(500).json({message:error.message});
19
+ }
20
+ };
21
+
22
+ //update
23
+
24
+ export const updatePayment = async (req,res) => {
25
+ try{
26
+ const payment = await Payment.findByIdAndUpdate(req.params.id, req.body, {new:true});
27
+ res.status(200).json(payment);
28
+ }catch(error){
29
+ res.status(500).json({message:error.message});
30
+ }
31
+ };
32
+
33
+ //delete
34
+
35
+ export const deletePayment = async (req,res) => {
36
+ try{
37
+ const payment = await Payment.findByIdAndDelete(req.params.id);
38
+ res.status(200).json({message:"parking slot deleted"});
39
+ }catch(error){
40
+ res.status(500).json({message:error.message});
41
+ }
42
+ };
@@ -0,0 +1,71 @@
1
+ import User from "../models/UserModels.js";
2
+
3
+ //create
4
+ export const userCreate = async (req,res) => {
5
+ try{
6
+ const user = await User.create(req.body);
7
+ res.status(201).json(user);
8
+ }catch(error){
9
+ res.status(500).json({message:error.message});
10
+ }
11
+ };
12
+
13
+ //read
14
+
15
+ export const getUser = async (req,res) => {
16
+ try{
17
+ const user = await User.find();
18
+ res.status(200).json(user);
19
+ }catch(error){
20
+ res.status(500).json({message:error.message});
21
+ }
22
+ };
23
+
24
+ //update
25
+
26
+ export const updateUser = async (req,res) => {
27
+ try{
28
+ const user = await User.findByIdAndUpdate(req.params.id, req.body, {new:true});
29
+ res.status(200).json(user);
30
+ }catch(error){
31
+ res.status(500).json({message:error.message});
32
+ }
33
+ };
34
+
35
+ //delete
36
+
37
+ export const deleteUser = async (req,res) => {
38
+ try{
39
+ const user = await User.findByIdAndDelete(req.params.id);
40
+ res.status(200).json({message:"user deleted"});
41
+ }catch(error){
42
+ res.status(500).json({message:error.message});
43
+ }
44
+ };
45
+
46
+ export const registerUser = async (req,res) => {
47
+ try{
48
+ const user = await User.create(req.body);
49
+ res.status(201).json({ message:"user registerd successfully", user, });
50
+ }catch(error){
51
+ res.status(500).json({message:error.message});
52
+ }
53
+ };
54
+
55
+ export const loginUser = async (req,res) => {
56
+ try{
57
+ const {userName, password} = req.body;
58
+ const user = await User.findOne({userName});
59
+
60
+ if(!user) {
61
+ return res.status(400).json({message:"user not found"});
62
+ }
63
+ if (user.password !== password){
64
+ return res.status(400).json({message:"wrong password"});
65
+ }
66
+ res.json({message:"Login successfully", user,
67
+ });
68
+ }catch(error){
69
+ res.status(500).json({message:error.message});
70
+ }
71
+ };
@@ -0,0 +1,11 @@
1
+ import mongoose from 'mongoose';
2
+
3
+ export const connectDB = async () => {
4
+ try{
5
+ await mongoose.connect(process.env.MONGO_URI);
6
+ console.log("connected to database");
7
+ }catch(error){
8
+ console.log("failed to connect to databse");
9
+ process.exit(1);
10
+ }
11
+ };
@@ -0,0 +1,9 @@
1
+ import mongoose from 'mongoose';
2
+
3
+ const carSchema = new mongoose.Schema ({
4
+ plateNumber: {type:String, required:true, unique:true},
5
+ driverName: {type:String, required:true},
6
+ phoneNumber:{type:String, required:true}
7
+ }, {timeStamps: true});
8
+
9
+ export default mongoose.model("Car", carSchema);
@@ -0,0 +1,10 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const recordSchema = new mongoose.Schema({
4
+ car: {type:mongoose.Schema.Types.ObjectId, ref: "Car"},
5
+ slot: {type:mongoose.Schema.Types.ObjectId, ref:"ParkingSlot"},
6
+ entryTime: {type:Date, required:true},
7
+ exitTime: {type:Date},
8
+ duration:{type:Number}
9
+ });
10
+ export default mongoose.model("ParkingRecord", recordSchema);
@@ -0,0 +1,7 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const slotSchema = new mongoose.Schema({
4
+ slotNumber:{type:String, required:true, unique:true},
5
+ slotStatus:{type:String, default:"Available"}
6
+ });
7
+ export default mongoose.model("ParkingSlot", slotSchema);
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const paymentSchema = new mongoose.Schema({
4
+ record:{type:mongoose.Schema.Types.ObjectId, ref:"ParkingRecord"},
5
+ amountPaid:{type:Number},
6
+ paymentDate:{type:Date, default:Date.now}
7
+ });
8
+
9
+ export default mongoose.model("Payment", paymentSchema);
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const userSchema = new mongoose.Schema({
4
+ email:{type:String, required:true ,unique:true},
5
+ userName:{type:String, required:true},
6
+ password:{type:String,required:true}
7
+ });
8
+
9
+ export default mongoose.model("User", userSchema);