Skip to content

Commit 8a91e9a

Browse files
committed
added routes
1 parent b082cf0 commit 8a91e9a

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed

SERVER/routes/Course.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Import the required modules
2+
const express = require("express")
3+
const router = express.Router()
4+
5+
// Import the Controllers
6+
7+
// Course Controllers Import
8+
const {
9+
createCourse,
10+
showAllCourses,
11+
getCourseDetails,
12+
} = require("../controllers/Course.controller")
13+
14+
15+
// Categories Controllers Import
16+
const {
17+
showAllCategories,
18+
createCategory,
19+
categoryPageDetails,
20+
} = require("../controllers/Category.controller")
21+
22+
// Sections Controllers Import
23+
const {
24+
createSection,
25+
updateSection,
26+
deleteSection,
27+
} = require("../controllers/Section.controller")
28+
29+
// Sub-Sections Controllers Import
30+
const {
31+
createSubSection,
32+
updateSubSection,
33+
deleteSubSection,
34+
} = require("../controllers/Subsection.controller")
35+
36+
// Rating Controllers Import
37+
const {
38+
createRating,
39+
getAverageRating,
40+
getAllRating,
41+
} = require("../controllers/RatingAndReview.controller")
42+
43+
// Importing Middlewares
44+
const { auth, isInstructor, isStudent, isAdmin } = require("../middlewares/auth.middleware")
45+
46+
47+
48+
// Courses can Only be Created by Instructors
49+
router.post("/createCourse", auth, isInstructor, createCourse)
50+
//Add a Section to a Course
51+
router.post("/addSection", auth, isInstructor, createSection)
52+
// Update a Section
53+
router.post("/updateSection", auth, isInstructor, updateSection)
54+
// Delete a Section
55+
router.post("/deleteSection", auth, isInstructor, deleteSection)
56+
// Edit Sub Section
57+
router.post("/updateSubSection", auth, isInstructor, updateSubSection)
58+
// Delete Sub Section
59+
router.post("/deleteSubSection", auth, isInstructor, deleteSubSection)
60+
// Add a Sub Section to a Section
61+
router.post("/addSubSection", auth, isInstructor, createSubSection)
62+
// Get all Registered Courses
63+
router.get("/getAllCourses", showAllCourses)
64+
// Get Details for a Specific Courses
65+
router.post("/getCourseDetails", getCourseDetails)
66+
67+
// ********************************************************************************************************
68+
// Category routes (Only by Admin)
69+
// ********************************************************************************************************
70+
// Category can Only be Created by Admin
71+
// TODO: Put IsAdmin Middleware here
72+
router.post("/createCategory", auth, isAdmin, createCategory)
73+
router.get("/showAllCategories", showAllCategories)
74+
router.post("/getCategoryPageDetails", categoryPageDetails)
75+
76+
77+
router.post("/createRating", auth, isStudent, createRating)
78+
router.get("/getAverageRating", getAverageRating)
79+
router.get("/getReviews", getAllRatingReview)
80+
81+
module.exports = router

SERVER/routes/Payments.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Import the required modules
2+
const express = require("express")
3+
const router = express.Router()
4+
5+
const { capturePayment, verifySignature } = require("../controllers/Payments.controller")
6+
const { auth, isInstructor, isStudent, isAdmin } = require("../middlewares/auth.middleware")
7+
8+
router.post("/capturePayment", auth, isStudent, capturePayment)
9+
router.post("/verifySignature", verifySignature)
10+
11+
module.exports = router

SERVER/routes/Profile.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const express = require("express")
2+
const router = express.Router()
3+
const { auth } = require("../middlewares/auth.middleware")
4+
const {
5+
deleteAccount,
6+
updateProfile,
7+
getAllUserDetails,
8+
updateDisplayPicture,
9+
getEnrolledCourses,
10+
} = require("../controllers/Profile.controller")
11+
12+
13+
// Delet User Account
14+
router.delete("/deleteProfile", deleteAccount)
15+
router.put("/updateProfile", auth, updateProfile)
16+
router.get("/getUserDetails", auth, getAllUserDetails)
17+
// Get Enrolled Courses
18+
router.get("/getEnrolledCourses", auth, getEnrolledCourses)
19+
router.put("/updateDisplayPicture", auth, updateDisplayPicture)
20+
21+
module.exports = router

SERVER/routes/User.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Import the required modules
2+
const express = require("express")
3+
const router = express.Router()
4+
5+
// Import the required controllers and middleware functions
6+
const {
7+
login,
8+
signUp,
9+
sendOTP,
10+
changePassword,
11+
} = require("../controllers/Auth.controller")
12+
const {
13+
resetPasswordToken,
14+
resetPassword,
15+
} = require("../controllers/ResetPassword.controller")
16+
17+
const { auth } = require("../middlewares/auth.middleware")
18+
19+
// Routes for Login, Signup, and Authentication
20+
21+
// ********************************************************************************************************
22+
// Authentication routes
23+
// ********************************************************************************************************
24+
25+
// Route for user login
26+
router.post("/login", login)
27+
28+
// Route for user signup
29+
router.post("/signup", signUp)
30+
31+
// Route for sending OTP to the user's email
32+
router.post("/sendotp", sendOTP)
33+
34+
// Route for Changing the password
35+
router.post("/changepassword", auth, changePassword)
36+
37+
38+
// Route for generating a reset password token
39+
router.post("/reset-password-token", resetPasswordToken)
40+
41+
// Route for resetting user's password after verification
42+
router.post("/reset-password", resetPassword)
43+
44+
// Export the router for use in the main application
45+
module.exports = router

0 commit comments

Comments
 (0)