Skip to content

Commit

Permalink
fix: add teacher auth for courese (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzdhybthu authored Jan 17, 2025
1 parent 22e14e1 commit 262881b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/routes/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ router.get("/is_manager", authenticate([]), async (req, res) => {
}
});

router.get("/comments/:course_uuid", authenticate(["student", "counselor"]), async (req, res) => {
router.get("/comments/:course_uuid", authenticate(["student", "teacher", "counselor"]), async (req, res) => {
try {
const current_user_uuid = req.auth.user.uuid;
const course_uuid = req.params.course_uuid;
Expand Down Expand Up @@ -165,7 +165,7 @@ router.post("/comments/display", authenticate(), async (req, res) => {
});


router.post("/comments/add", authenticate(["student", "counselor"]), async (req, res) => {
router.post("/comments/add", authenticate(["student", "teacher", "counselor"]), async (req, res) => {
try {
const comment: string = req.body.comment;
const user_uuid: string = req.auth.user.uuid;
Expand Down Expand Up @@ -221,7 +221,7 @@ router.post("/comments/add", authenticate(["student", "counselor"]), async (req,
}
});

router.post("/comments/update", authenticate(["student", "counselor"]), async (req, res) => {
router.post("/comments/update", authenticate(["student", "teacher", "counselor"]), async (req, res) => {
try {
const user_uuid = req.auth.user.uuid;
const comment_uuid = req.body.comment_uuid;
Expand Down Expand Up @@ -256,7 +256,7 @@ router.post("/comments/update", authenticate(["student", "counselor"]), async (r
});


router.post("/comments/delete", authenticate(["student", "counselor"]), async (req, res) => {
router.post("/comments/delete", authenticate(["student", "teacher", "counselor"]), async (req, res) => {
try {
const user_uuid = req.auth.user.uuid;
const comment_uuid = req.body.comment_uuid;
Expand Down Expand Up @@ -285,7 +285,7 @@ router.post("/comments/delete", authenticate(["student", "counselor"]), async (r



router.post("/comments/stars/toggle", authenticate(["student", "counselor"]), async (req, res) => {
router.post("/comments/stars/toggle", authenticate(["student", "teacher", "counselor"]), async (req, res) => {
try {
const comment_uuid: string = req.body.comment_uuid;
const user_uuid: string = req.auth.user.uuid;
Expand All @@ -309,7 +309,7 @@ router.post("/comments/stars/toggle", authenticate(["student", "counselor"]), as
});


router.post("/comments/likes/toggle", authenticate(["student", "counselor"]), async (req, res) => {
router.post("/comments/likes/toggle", authenticate(["student", "teacher", "counselor"]), async (req, res) => {
try {
const comment_uuid: string = req.body.comment_uuid;
const user_uuid: string = req.auth.user.uuid;
Expand Down

0 comments on commit 262881b

Please sign in to comment.