# Basisc html/css/js service ## List of events that basic-html-css-service publishes ### Exercise event <span style="color:#58a6ff">1. exercise.created binding key</span> Description: This event is published when exercise is created by teacher > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": { "_id": "exerciseId", "exercise_name": "BTCN 1: Understand HTML structure", "exercise_deadline": 2324545, "creator_id": "userId", "creator_name": "Nguyễn Đức Huy", "course_id": "courseId" }, "event": { "_id": "event id" } } ``` <span style="color:#58a6ff">2. exercise.update binding key</span> Description: This event is published when exercise is updated by teacher > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": { "_id": "exerciseId", "exercise_name": "BTCN 1: Understand HTML structure", "exercise_deadline": 2324545, "course_id": "courseId" }, "event": { "_id": "event id" } } ``` <span style="color:#58a6ff">3. exercise.delete binding key</span> Description: This event is published when exercise is deleted by teacher > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": { "_id": "exerciseId", }, "event": { "_id": "event id" } } ``` <span style="color:#58a6ff">4. exercise.submit binding key</span> Description: This event is published when exercise is submitted by student > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": { "_id": "exerciseId", "submitter_id": "userId", "submitter_name": "Trần Tú Hảo", "submitter_email": "tuhao99@gmail.com" }, "event": { "_id": "event id" } } ``` <span style="color:#58a6ff">5. exercise.remark binding key</span> Description: This event is published when exercise is remarked by teacher > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": { "_id": "exerciseId" }, "event": { "_id": "event id" } } ``` <span style="color:#58a6ff">6. exercise.comment binding key</span> Description: This event is published when comment is created by user > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "comment": { "_id": "commentId", "commentator_id": "userId", "commentator_name": "Trần Tú Hảo", "exercise_id": "exerciseId", "exercise_name": "layout với CSS" }, "event": { "_id": "eventId" } } ``` <span style="color:#58a6ff">7. exercise.replyComment binding key</span> Description: This event is published when comment is replied by user > exchange name: <b>notification-ex</b> > exchange type: <b>direct</b> > queue name: <b>notification-svc-exercise-event-handler</b> ```Message``` ```json= { "comment": { "_id": "commentId", "comment_parent": "commentId", "comment_parent_owner_email": "tuhao@gmail.com", "commentator_id": "userId", "commentator_name": "Trần Tú Hảo", "exercise_id": "exerciseId", "exercise_name": "layout với CSS" }, "event": { "_id": "eventId" } } ``` <span style="color:#58a6ff">8. exercise.public.save</span> Description: This event is published when teacher publishes to public repository > exchange name: <b>repository-ex</b> > exchange type: <b>direct</b> > queue name: <b>public-repository-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": [ { "exercise_name": "BTCN 1 Understand HTML structure", "exercise_description": "Welcome to the world of code! Last year, millions of learners from our community started with HTML. Why? HTML is the skeleton of all web pages.", "exercise_type": "JS", "exercise_code_html": "<h1></h1>", "exercise_code_css": ".eye { background-color: #fff }", "exercise_code_js": "var a = 'token'; console.log(a.length);", "created_by": "7092eebd-7ceb-4ab1-b7c0-4f2066de2435" } ], "event": { "_id": "eventId" } } ``` <span style="color:#58a6ff">9. exercise.private.save</span> Description: This event is published when teacher publishes to public repository > exchange name: <b>repository-ex</b> > exchange type: <b>direct</b> > queue name: <b>private-repository-svc-exercise-event-handler</b> ```Message``` ```json= { "exercise": [ { "exercise_name": "BTCN 1 Understand HTML structure", "exercise_description": "Welcome to the world of code! Last year, millions of learners from our community started with HTML. Why? HTML is the skeleton of all web pages.", "exercise_type": "JS", "exercise_code_html": "<h1></h1>", "exercise_code_css": ".eye { background-color: #fff }", "exercise_code_js": "var a = 'token'; console.log(a.length);", "created_by": "7092eebd-7ceb-4ab1-b7c0-4f2066de2435" } ], "event": { "_id": "eventId" } } ``` ## List of events that basic-html-css-service consumes ### Register Event Description: This event is published by register service > exchange name: <b>auth-ex</b> >exchange type: <b>fanout</b> > queue name: <b>exercise-svc-register-event-handler</b> ```Message``` ```json= { "user": { "_id": "userId", "username": "NGUYEN VAN A", "avatar": "http://avatar.com", "email": "17128001@student.hcmus.edu.vn", "student_code": "17128001" }, "event": { "_id": "eventId" } } ``` ### Profile Event Description: This event is published by profile service > exchange name: <b>profile-ex</b> > exchange type: <b>fanout</b> > queue name: <b>exercise-svc-user-profile-event-handler</b> ```Message``` ```json= { "user": { "_id": "userId", "username": "NGUYEN VAN A", "avatar": "http://avatar.com", "student_code": "17128001" }, "event": { "_id": "eventId" } } ``` ### Repository Event Description: This event is published by repository service > exchange name: <b>exercise-ex</b> > exchange type: <b>direct</b> > queue name: <b>exercise-svc-repository-event-handler</b> ```Message``` ```json= { "data": { "count": 1, "course_id": "courseId", "user_id": "userId", "exercises": [ { "exercise_name": "BTCN 1 Understand HTML structure", "exercise_description": "Welcome to the world of code! Last year, millions of learners from our community started with HTML. Why? HTML is the skeleton of all web pages.", "exercise_type": "JS", "exercise_code_html": "<h1></h1>", "exercise_code_css": ".eye { background-color: #fff }", } ] }, "event": { "_id": "eventId" } } ```