# Basisc html/css/js service
## List of events that basic-html-css-service publish
### 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: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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">6. exercise.replyComment binding key</span>
Description: This event is published when comment is reply by user
> exchange name: notification-ex
> exchange type: direct
> queue name: notification-svc-exercise-event-handler
```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"
}
}
```
## List of events that basic-html-css-service consumes
### Register Event
Description: This event is published by register service
> exchange name: auth-ex
>exchange type: fanout
> queue name: exercise-svc-register-event-handler
```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: profile-ex
>exchange type: fanout
> queue name: exercise-svc-user-profile-event-handler
```Message```
```JSON
{
"user": {
"_id": "userId",
"username": "NGUYEN VAN A",
"avatar": "http://avatar.com",
"student_code": "17128001"
},
"event": {
"_id": "eventId"
}
}
```