create-myexam-app 1.0.5 → 1.0.6

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 (50) hide show
  1. package/index.js +6 -6
  2. package/package.json +1 -1
  3. package/projects/sfms-app/backend/.env +4 -0
  4. package/projects/sfms-app/backend/controllers/FeesController.js +36 -0
  5. package/projects/sfms-app/backend/controllers/PaymentController.js +42 -0
  6. package/projects/sfms-app/backend/controllers/RecordController.js +39 -0
  7. package/projects/sfms-app/backend/controllers/StudentController.js +39 -0
  8. package/projects/sfms-app/backend/controllers/UserController.js +37 -0
  9. package/projects/sfms-app/backend/db/connectDB.js +13 -0
  10. package/projects/sfms-app/backend/models/Fees.js +7 -0
  11. package/projects/sfms-app/backend/models/Payment.js +8 -0
  12. package/projects/sfms-app/backend/models/Record.js +8 -0
  13. package/projects/sfms-app/backend/models/Student.js +9 -0
  14. package/projects/sfms-app/backend/models/User.js +9 -0
  15. package/projects/sfms-app/backend/package-lock.json +1568 -0
  16. package/projects/sfms-app/backend/package.json +23 -0
  17. package/projects/sfms-app/backend/routes/FeesRoutes.js +11 -0
  18. package/projects/sfms-app/backend/routes/PaymentRoutes.js +10 -0
  19. package/projects/sfms-app/backend/routes/RecordRoutes.js +10 -0
  20. package/projects/sfms-app/backend/routes/StudentRoutes.js +11 -0
  21. package/projects/sfms-app/backend/routes/UserRoutes.js +8 -0
  22. package/projects/sfms-app/backend/server.js +33 -0
  23. package/projects/sfms-app/frontend/README.md +16 -0
  24. package/projects/sfms-app/frontend/eslint.config.js +21 -0
  25. package/projects/sfms-app/frontend/index.html +13 -0
  26. package/projects/sfms-app/frontend/package-lock.json +3050 -0
  27. package/projects/sfms-app/frontend/package.json +31 -0
  28. package/projects/sfms-app/frontend/public/favicon.svg +1 -0
  29. package/projects/sfms-app/frontend/public/icons.svg +24 -0
  30. package/projects/sfms-app/frontend/src/App.css +184 -0
  31. package/projects/sfms-app/frontend/src/App.jsx +29 -0
  32. package/projects/sfms-app/frontend/src/assets/hero.png +0 -0
  33. package/projects/sfms-app/frontend/src/assets/react.svg +1 -0
  34. package/projects/sfms-app/frontend/src/assets/vite.svg +1 -0
  35. package/projects/sfms-app/frontend/src/components/Navbar.jsx +44 -0
  36. package/projects/sfms-app/frontend/src/index.css +1 -0
  37. package/projects/sfms-app/frontend/src/main.jsx +10 -0
  38. package/projects/sfms-app/frontend/src/pages/Dashboard.jsx +40 -0
  39. package/projects/sfms-app/frontend/src/pages/Fees.jsx +108 -0
  40. package/projects/sfms-app/frontend/src/pages/Login.jsx +53 -0
  41. package/projects/sfms-app/frontend/src/pages/Payments.jsx +120 -0
  42. package/projects/sfms-app/frontend/src/pages/Records.jsx +173 -0
  43. package/projects/sfms-app/frontend/src/pages/Register.jsx +57 -0
  44. package/projects/sfms-app/frontend/src/pages/Student.jsx +127 -0
  45. package/projects/sfms-app/frontend/vite.config.js +11 -0
  46. package/projects/head/index.js +0 -71
  47. package/projects/head/node_modules/.package-lock.json +0 -12
  48. package/projects/head/package-lock.json +0 -45
  49. package/projects/head/package.json +0 -29
  50. package/projects/payment/PaymentController.js +0 -37
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const console = require('console')
3
4
  const fs = require('fs')
4
5
  const path = require('path')
5
6
  const readline = require('readline')
@@ -12,9 +13,9 @@ const rl = readline.createInterface({
12
13
  console.log('\n[1] Hospital Management System')
13
14
  console.log('[2] Library System Management')
14
15
  console.log('[3] Parking Management System')
15
- console.log('[4] School Management System\n')
16
- console.log('[5] payment ' )
17
- console.log('[6] head')
16
+ console.log('[4] School fee Management System')
17
+
18
+
18
19
 
19
20
  rl.question('Pick (1-4): ', (answer) => {
20
21
 
@@ -22,9 +23,8 @@ rl.question('Pick (1-4): ', (answer) => {
22
23
  '1': 'hospital management system',
23
24
  '2': 'libray system management',
24
25
  '3': 'parking managementt system',
25
- '4': 'school management system',
26
- '5': 'payment',
27
- '6':'head'
26
+ '4': 'sfms-app',
27
+
28
28
  }
29
29
 
30
30
  const chosen = projects[answer]
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  "name": "create-myexam-app",
4
4
 
5
- "version": "1.0.5",
5
+ "version": "1.0.6",
6
6
 
7
7
  "description": "My exam projects",
8
8
 
@@ -0,0 +1,4 @@
1
+ PORT=5000
2
+
3
+ MONGO_URI=mongodb://localhost:27017/seed
4
+ JWT=your-secret-key-here
@@ -0,0 +1,36 @@
1
+ import Fees from '../models/Fees.js'
2
+
3
+ export const createFees = async(req,res) => {
4
+ try{
5
+ const fees = await Fees.create(req.body);
6
+ res.status(201).json(fees);
7
+ }catch(error){
8
+ res.status(500).json({message:error.message});
9
+ }
10
+ };
11
+
12
+ export const getFees = async(req,res) => {
13
+ try{
14
+ const fees = await Fees.find();
15
+ res.status(200).json(fees);
16
+ }catch(error){
17
+ res.status(500).json({message:error.message});
18
+ }
19
+ };
20
+
21
+ export const updateFees = async(req,res) => {
22
+ try{
23
+ const fees = await Fees.findByIdAndUpdate(req.body);
24
+ res.status(200).json(fees);
25
+ }catch(error){
26
+ res.status(500).json({message:error.message});
27
+ }
28
+ };
29
+ export const deleteFees = async (req,res) => {
30
+ try{
31
+ const fees = await Fees.findByIdAndDelete(req.params.id);
32
+ res.status(200).json({message:"fee deleted succussfully"});
33
+ }catch(error){
34
+ res.status(500).json({message:error.message});
35
+ }
36
+ };
@@ -0,0 +1,42 @@
1
+ import Student from "../models/Student.js"
2
+ import Payment from "../models/Payment.js";
3
+
4
+ export const createPayment = async(req,res) => {
5
+ try{
6
+ const payment = await Payment.create(req.body);
7
+ res.status(201).json(payment);
8
+ }catch(error){
9
+ res.status(500).json({message:error.message});
10
+ }
11
+ };
12
+
13
+ export const getPayment = async(req,res) => {
14
+ try{
15
+ const payment = await Payment.find()
16
+ .populate('student')
17
+ .populate('fees')
18
+ res.status(200).json(payment);
19
+ }catch(error){
20
+
21
+ res.status(500).json({message:error.message});
22
+ }
23
+ };
24
+
25
+ export const updatePayment = async(req,res) => {
26
+ try{
27
+ const payment = await Payment.findByIdAndUpdate(req.body);
28
+ res.status(201).json(payment);
29
+ }catch(error){
30
+ res.status(500).json({message:error.message});
31
+ }
32
+ };
33
+
34
+ export const deletePayment = async(req,res) => {
35
+ try{
36
+ const payment = await Payment.findByIdAndDelete(req.body);
37
+ res.status(200).json({message:"payment deleted succussfully"});
38
+ }catch(error){
39
+
40
+ res.status(500).json({message:error.message});
41
+ }
42
+ };
@@ -0,0 +1,39 @@
1
+
2
+ import Record from "../models/Record.js";
3
+ import { json } from "express";
4
+
5
+ export const createRecord = async (req,res) => {
6
+ try{
7
+ const record = await Record.create(req.body);
8
+ res.status(201).json(record);
9
+ }catch(error){
10
+ res.status(500).json({message:error.message});
11
+ }
12
+ };
13
+
14
+ export const getRecord = async (req,res) => {
15
+ try{
16
+ const record = await Record.findOne();
17
+ res.status(200).json(record);
18
+ }catch(error){
19
+ res.status(500).json({message:error.message});
20
+ }
21
+ };
22
+
23
+ export const updateRecord = async (req,res) => {
24
+ try{
25
+ const record = await Record.findByIdAndUpdate(req.body);
26
+ res.status(200).json(record)
27
+ }catch(error){
28
+ res.status(500).json({message:error.message});
29
+ }
30
+ };
31
+
32
+ export const deleteRecord = async (req,res) => {
33
+ try{
34
+ const record = await Record.findByIdAndDelete(req.body);
35
+ res.status(200).json({message:"record succssfullt deleted"})
36
+ }catch(error){
37
+ res.status(500).json({message:error.message});
38
+ }
39
+ };
@@ -0,0 +1,39 @@
1
+ import Student from '../models/Student.js'
2
+
3
+ export const createStudent = async(req,res) => {
4
+ try{
5
+ const student = await Student.create(req.body);
6
+ res.status(201).json(student);
7
+ }catch(error){
8
+
9
+ res.status(500).json({message:error.message});
10
+ }
11
+ };
12
+
13
+ export const getStudent = async (req,res) => {
14
+ try{
15
+ const student = await Student.find();
16
+ res.status(200).json(student);
17
+ }catch(error){
18
+ res.status(500).json({message:error.message});
19
+ }
20
+ };
21
+
22
+ export const updateStudent = async (req,res) => {
23
+ try{
24
+ const student = await Student.findByIdAndUpdate();
25
+ res.status(200).json(student);
26
+ }catch(error){
27
+ res.status(500).json({message:error.message});
28
+ }
29
+ };
30
+
31
+ export const deleteStudent = async (req,res) => {
32
+ try{
33
+ const student = await Student.findByIdAndDelete(req.params.id);
34
+ res.status(200).json({message:"deleted succssfully"});
35
+ }catch(error){
36
+ res.status(500).json({message:error.message});
37
+ }
38
+ };
39
+
@@ -0,0 +1,37 @@
1
+ import User from "../models/User.js";
2
+ import bcrypt from 'bcrypt'
3
+ import JWT from 'jsonwebtoken'
4
+
5
+
6
+ export const registerUser = async (req,res) => {
7
+ try{
8
+ const {name,email,password} = req.body;
9
+ const existingUser = await User.findOne({email});
10
+ if(existingUser){
11
+ return res.status(400).json({message:"user arleady exist"});
12
+ }
13
+ const hashedPassword = await bcrypt.hash(password, 10);
14
+ const user = await User.create({name,email,password:hashedPassword});
15
+ res.status(201).json({message:"register succussfully", user});
16
+ }catch(error){
17
+ res.status(500).json({message:error.message});
18
+ }
19
+ };
20
+
21
+ export const loginUser = async(req,res) => {
22
+ try{
23
+ const {email,password} = req.body;
24
+ const user = await User.findOne({email});
25
+ if(!user){
26
+ return res.status(400).json({message:"user not found"});
27
+ }
28
+ const isMatch = await bcrypt.compare(password, user.password);
29
+ if(!isMatch){
30
+ return res.status(400).json({message:"wrong password"});
31
+ }
32
+ const token = JWT.sign({id:user._id}, process.env.JWT_SECRET, {expiresIn:"7d"});
33
+ res.status(200).json({message:"loged in Succussfully", token});
34
+ }catch(error){
35
+ res.status(500).json({message:error.message});
36
+ }
37
+ };
@@ -0,0 +1,13 @@
1
+ import mongoose from "mongoose"
2
+
3
+ export const connectDB = async () => {
4
+ console.log('connecting to database....')
5
+ try{
6
+ await mongoose.connect(process.env.MONGO_URI);
7
+ console.log('Connected to database');
8
+ }catch(error){
9
+ console.log("Failed to connect to database");
10
+ process.exit(1);
11
+ }
12
+
13
+ }
@@ -0,0 +1,7 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const feesSchema = new mongoose.Schema({
4
+ amount:{type:String, required:true}
5
+ });
6
+
7
+ export default mongoose.model("Fees", feesSchema);
@@ -0,0 +1,8 @@
1
+ import mongoose, { modelNames } from "mongoose";
2
+
3
+ const paymentSchema = new mongoose.Schema({
4
+ student:{type:mongoose.Schema.Types.ObjectId, ref:"Student", required:true},
5
+ fees:{type:mongoose.Schema.Types.ObjectId, ref:"Fees", required:true},
6
+ paymentDate:{type: Date, required:true}
7
+ });
8
+ export default mongoose.model("Payment", paymentSchema);
@@ -0,0 +1,8 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const recordSchema = new mongoose.Schema({
4
+ payment:{type:mongoose.Schema.Types.ObjectId, ref:"Payment", required:true},
5
+ term:{type:String, required:true}
6
+ });
7
+
8
+ export default mongoose.model("Record", recordSchema);
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const studentSchema = new mongoose.Schema({
4
+ name:{type:String, required:true},
5
+ studentClass:{type:String, required:true}
6
+
7
+ });
8
+
9
+ export default mongoose.model("Student", studentSchema);
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const userSchema = new mongoose.Schema({
4
+ name:{type:String, required:true},
5
+ email:{type:String, required:true},
6
+ password:{type:String, required:true}
7
+ });
8
+
9
+ export default mongoose.model("User", userSchema);