# CSS game service
## List of events that notification-service consumes
### 1. Register Event
Description: This event is published by register service
> exchange name: auth-ex
> exchange type: fanout
> queue name: css-game-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"
}
}
```
### 2. Profile Event
Description: This event is published by profile service
> exchange name: profile-ex
> exchange type: fanout
> queue name: css-game-svc-user-profile-event-handler
```Message```
```json=
{
"user": {
"_id": "userId",
"username": "NGUYEN VAN A",
"avatar": "http://avatar.com",
"student_code": "17128001"
},
"event": {
"_id": "eventId"
}
}
```
## List of events that notification-service consumes
### 1. Exercise created event
Description: This event is published from <b>css game service</b> when teacher create an exercise
> exchange name: notification-ex
> exchange type: direct
> queue name: notification-svc-css-game-event-handler
> key: cssgame.exercise.created
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "layout với CSS",
"exercise_deadline": 12135155,
"course_id": "courseId",
"creator_id": "userId",
"creator_name": "Nguyễn Đức Huy"
},
"event": {
"_id": "eventId"
}
}
```
### 2. Exercise updated event
Description: This event is published from <b>css game service</b> when teacher update an exercise
> exchange name: notification-ex
exchange type: direct
> queue name: notification-svc-css-game-event-handler
> key: cssgame.exercise.update
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "layout với CSS",
"exercise_deadline": 12135155
},
"event": {
"_id": "eventId"
}
}
```
### 3. Exercise deleted event
Description: This event is published from <b>css game service</b> when teacher delete an exercise
> exchange name: notification-ex
exchange type: direct
> queue name: notification-svc-css-game-event-handler
> key: cssgame.exercise.delete
```Message```
```json=
{
"exercise": {
"_id": "exerciseId"
},
"event": {
"_id": "eventId"
}
}
```
### 4. Exercise submitted event
Description: This event is published from <b>css game service</b> when students submit their solution
> exchange name: notification-ex
exchange type: direct
> queue name: notification-svc-css-game-event-handler
> key: cssgame.exercise.submit
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"submitter_id": "userId",
"submitter_name": "Trần Tú Hảo",
"submitter_email": "tuhao99@gmail.com"
},
"event": {
"_id": "eventId"
}
}
```
### 5. New comment in exercise event
Description: This event is published from <b>css game service</b> when user comment in an exercise
> exchange name: notification-ex
exchange type: direct
> queue name: notification-svc-css-game-event-handler
> key: cssgame.exercise.comment
```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"
}
}
```
### 6. Reply Comment in exercise event
Description: This event is published from <b>css game service</b> when user reply your comment in an exercise
> exchange name: notification-ex
exchange type: direct
> queue name: notification-svc-exercise-event-handler
> key: cssgame.exercise.replyComment
```Message```
```json=
{
"comment": {
"_id": "commentId",
"comment_parent": "commentId",
"comment_parent_owner_id": "userId",
"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"
}
}
```