# Exercise Aggregator Service
## List of events that exercise aggregator service consumes
### Basic html/css/js service
Description: This event is published by basic-html-css-js service
> exchange name: <b>exercise-aggregator-ex</b>
>exchange type: <b>topic</b>
> queue name:
* <b>exercise-aggregator-svc-basic-exercise-event-handler</b>
* Binding key: <b>basic.*</b>
1. <span style="color:#58a6ff;">basic.created routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "BTCN 1: Understand HTML structure",
"exercise_rate": 10,
"exercise_deadline": 121313213132,
"exercise_type": "HTML | CSS | JAVASCRIPT",
"course_id": "courseId",
"created_at": 121313213132,
"user_id": "userId"
},
"event": {
"_id": "eventId"
}
}
```
2. <span style="color:#58a6ff;">basic.updated routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "BTCN 1: Understand HTML structure",
"exercise_deadline": 121313213132",
"exercise_type": "HTML | CSS | JAVASCRIPT",
"exercise_rate": 10,
},
"event": {
"_id": "eventId"
}
}
```
3. <span style="color:#58a6ff;">basic.deleted routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId"
},
"event": {
"_id": "eventId"
}
}
```
### Css game service
Description: This event is published by css-game service
> exchange name: <b>exercise-aggregator-ex</b>
>exchange type: <b>topic</b>
> queue name:
* <b>exercise-aggregator-svc-css-game-event-handler</b>
* Binding key: <b>cssgame.*</b>
1. <span style="color:#58a6ff;">cssgame.created routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "BTCN 1: Understand HTML structure",
"exercise_deadline": 121313213132,
"exercise_type": "CSS_GAME",
"exercise_rate": 10,
"course_id": "courseId",
"created_at": 121313213132,
"user_id": "userId"
},
"event": {
"_id": "eventId"
}
}
```
2. <span style="color:#58a6ff;">cssgame.updated routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "BTCN 1: Understand HTML structure",
"exercise_deadline": 121313213132,
"exercise_type": "CSS_GAME",
"exercise_rate": 10,
},
"event": {
"_id": "eventId"
}
}
```
3. <span style="color:#58a6ff;">cssgame.deleted routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId"
},
"event": {
"_id": "eventId"
}
}
```
### Pure javascript service
Description: This event is published by pure javascript service
> exchange name: <b>exercise-aggregator-ex</b>
>exchange type: <b>topic</b>
> queue name:
* <b>exercise-aggregator-svc-pure-javascript-event-handler</b>
* Binding key: <b>pure.javascript.*</b>
1. <span style="color:#58a6ff;">pure.javascript.created routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "BTCN 1: Understand HTML structure",
"exercise_deadline": 121313213132,
"exercise_type": "PURE_JAVASCRIPT",
"exercise_rate": 10,
"course_id": "courseId",
"created_at": 121313213132,
"user_id": "userId"
},
"event": {
"_id": "eventId"
}
}
```
2. <span style="color:#58a6ff;">pure.javascript.updated routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId",
"exercise_name": "BTCN 1: Understand HTML structure",
"exercise_deadline": 121313213132,
"exercise_type": "PURE_JAVASCRIPT",
"exercise_rate": 10,
},
"event": {
"_id": "eventId"
}
}
```
3. <span style="color:#58a6ff;">pure.javascript.deleted routing key</span>
```Message```
```json=
{
"exercise": {
"_id": "exerciseId"
},
"event": {
"_id": "eventId"
}
}
```
### Basic html/css/javascript service - Css game service - Pure game service
1. <span style="color:#58a6ff;">solution.created binding key</span>
Description: This event is published by exercise services
> exchange name: <b>solution-aggregator-ex</b>
> exchange type: <b>direct</b>
> queue name: <b>exercise-aggregator-svc-solution-event-handler</b>
```Message```
```json=
{
"solution": {
"_id": "solutionId",
"created_at": 313213215654,
"user_id": "userId",
"exercise_id": "exerciseId"
},
"event": {
"_id": "eventId"
}
}
```
2. <span style="color:#58a6ff;">solution.submitted binding key</span>
Description: This event is published by exercise services
> exchange name: <b>solution-aggregator-ex</b>
> exchange type: <b>direct</b>
> queue name: <b>exercise-aggregator-svc-solution-event-handler</b>
```Message```
```json=
{
"solution": {
"_id": "solutionId",//css game dont need this field
"user_id": "userId", //only css game need this field
"exercise_id": "exerciseId",//only css game need this field
"exercise_type": "CSS_GAME",//only css game need this field
"solution_submitted": true,
"updated_at": 123465465464
},
"event": {
"_id": "eventId"
}
}
```
3. <span style="color:#58a6ff;">solution.marked binding key</span>
Description: This event is published by exercise services
> exchange name: <b>solution-aggregator-ex</b>
> exchange type: <b>direct</b>
> queue name: <b>exercise-aggregator-svc-solution-event-handler</b>
```Message```
```json=
{
"solution": {
"_id": "solutionId",//css game dont need this field
"user_id": "userId", //only css game need this field
"exercise_id": "exerciseId",//only css game need this field
"exercise_type": "CSS_GAME",//only css game need this field
"solution_point": 9,
"teacher_id": "teacherId"
},
"event": {
"_id": "eventId"
}
}
```