# Authorization Service ## List of events that authorization service consumes ### Course Service Description: This event is published by course service > exchange name: <b>course-authz-ex</b> > exchange type: <b>direct</b> > queue name: <b>authorization-svc-course-event-handler</b> 1. <span style="color:#58a6ff;">course.created binding key</span> ```Message``` ```json= { "course": { "_id": "courseId", "course_name": "react 2", "user_id": "userId", "created_at": 1321313213, // Unix time "participants": ["student_1", "student_2", "student_3"] "teachers": ["teacher_1", "teacher_2", "teacher_3"], "is_ended": false, "is_disabled": false, }, "event": { "_id": "eventId" } } ``` 2. <span style="color:#58a6ff;">course.updated binding key</span> ```Message``` ```json= { "course": { "_id": "courseId", "course_name": "react 3", "teachers": ["teacher_1", "teacher_2", "teacher_3"] "is_ended": true, "is_disabled": false, "ended_at": 1121212121565 //chỉ có field này khi is_ended = true }, "event": { "_id": "eventId" } } ``` 3. <span style="color:#58a6ff;">course.deleted binding key</span> ```Message``` ```json= { "course": { "_id": "courseId" }, "event": { "_id": "eventId" } } ``` 4. <span style="color:#58a6ff;">course.joined binding key</span> ```Message``` ```json= { "course": { "_id": "courseId", "student_id": "studentId" }, "event": { "_id": "eventId" } } ``` 5. <span style="color:#58a6ff;">course.removed binding key</span> ```Message``` ```json= { "course": { "_id": "courseId", "student_id": "studentId" }, "event": { "_id": "eventId" } } ``` ### Comment - Course Service > exchange name: <b>course-authz-ex</b> > exchange type: <b>direct</b> > queue name: <b>authorization-svc-course-comment-event-handler</b> 1. <span style="color:#58a6ff;">comment.created binding key</span> ```Message``` ```json= { "comment": { "_id": "commentId", "parent": "commentParentId", "course_id": "courseId", "created_by": "userId" }, "event": { "_id": "eventId" } } ``` 2. <span style="color:#58a6ff;">comment.deleted binding key</span> ```Message``` ```json= { "comment": { "_id": "commentId", }, "event": { "_id": "eventId" } } ``` ### Exercise - Basic HTML/CSS/JS | Css Game | Pure Js Service > exchange name: <b>exercise-authz-ex</b> > exchange type: <b>direct</b> > queue name: <b>authorization-svc-exercise-event-handler</b> 1. <span style="color:#58a6ff;">exercise.created binding key</span> ```Message``` ```json= { "exercise": { "_id": "exerciseId", "course_id": "courseId", "created_by": "user_id" }, "event": { "_id": "eventId" } } ``` 2. <span style="color:#58a6ff;">exercise.deleted binding key</span> ```Message``` ```json= { "exercise": { "_id": "exerciseId", }, "event": { "_id": "eventId" } } ``` ### Comment - Basic HTML/CSS/JS | Css Game | Pure Js Service > exchange name: <b>exercise-authz-ex</b> > exchange type: <b>direct</b> > queue name: <b>authorization-svc-exercise-comment-event-handler</b> 1. <span style="color:#58a6ff;">comment.created binding key</span> ```Message``` ```json= { "comment": { "_id": "commentId", "parent": "commentParentId", "exercise_id": "exerciseId", "created_by": "userId" }, "event": { "_id": "eventId" } } ``` 2. <span style="color:#58a6ff;">comment.deleted binding key</span> ```Message``` ```json= { "comment": { "_id": "commentId", }, "event": { "_id": "eventId" } } ```