| ... | @@ -76,6 +76,153 @@ |
... | @@ -76,6 +76,153 @@ |
|
|
|
|
|
|
|
## Join Challenge
|
|
## Join Challenge
|
|
|
|
|
|
|
|
|
> User can join a challenge room by using the challenge room's `CODE` shared by the `GAMEMASTER`. After validating the joining `CODE` user receives JWT `TOKEN` titled `PLAYER` to proceed into the challenge game room. Header payload must include desired `PLAYER` `userName`.
|
|
|
|
|
|
|
|
| Method | Route | Content type | Authentication |
|
|
|
|
|--------|-------|--------------|----------------|
|
|
|
|
| POST | /challenge/join/{roomCode} | `application/json` | No |
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary><b>Required Body</b></summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"userName": "string",
|
|
|
|
"userAvatar": "number"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
<details><summary><b>Example Responses</b></summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"statusCode": 200,
|
|
|
|
"message": "Joining to the challenge room was successfully",
|
|
|
|
"details": {
|
|
|
|
"userId": "3f45526e-1534-48f6-917b-8fb0bf7d4354",
|
|
|
|
"userAvatar": 1,
|
|
|
|
"username": "Test gamer",
|
|
|
|
"isGameMaster": false,
|
|
|
|
"challengeRoomId": "7eaf76ea-b056-433d-98dc-6dc053f862c4",
|
|
|
|
"challengeRoomCode": "ah34",
|
|
|
|
"challengeRoomName": "Test game",
|
|
|
|
"challengeStartDate": "2021-07-23T11:16:08.655Z",
|
|
|
|
"challengeEndDate": "2021-07-23T11:46:08.000Z",
|
|
|
|
"challengeTasks": [
|
|
|
|
{
|
|
|
|
"taskNumber": 1,
|
|
|
|
"taskDescription": "Haaste 1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"taskNumber": 2,
|
|
|
|
"taskDescription": "Haaste 2"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJMZWFkZXIiOiJFbG1lciIsIlVJVVgiOiJFbGxhIiwiRGV2T3BzIjoiRWV0dSIsIlRlc3RlciI6IklsZGlrbyIsIkZyb250IjoiTWlydmEiLCJGdWxsQXMwIjoiTWFya2t1IiwiRnVsbEFzMSI6Ik9sbGkifQ.vR2qPO_hgUnRXp7lbqgDoOrBfqNvW-o9KCw0i2iM3u8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"statusCode": 400,
|
|
|
|
"error": "Bad Request",
|
|
|
|
"message": "\"Username\" must be a string",
|
|
|
|
"validation": {
|
|
|
|
"source": "payload",
|
|
|
|
"keys": [
|
|
|
|
"userName"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"statusCode": 400,
|
|
|
|
"error": "Bad Request",
|
|
|
|
"message": "\"Challenge room code\" length must be 4 characters long",
|
|
|
|
"validation": {
|
|
|
|
"source": "params",
|
|
|
|
"keys": [
|
|
|
|
"challengeRoomCode"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"statusCode": 404,
|
|
|
|
"error": "Challenge room code invalid",
|
|
|
|
"message": "Challenge room not found with code: ${roomCode}"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
## Exit Challenge
|
|
## Exit Challenge
|
|
|
|
|
|
|
|
|
> Desc
|
|
|
|
|
|
|
|
| Method | Route | Content type | Authentication |
|
|
|
|
|--------|-------|--------------|----------------|
|
|
|
|
| POST | route | `application/json` | No |
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary><b>Required Body</b></summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
Body
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
<details><summary><b>Example Responses</b></summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
Success
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
Error
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
## Rejoin Challenge
|
|
## Rejoin Challenge
|
|
|
|
|
|
|
|
> Desc
|
|
|
|
|
|
|
|
| Method | Route | Content type | Authentication |
|
|
|
|
|--------|-------|--------------|----------------|
|
|
|
|
| POST | route | `application/json` | No |
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary><b>Required Body</b></summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
Body
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
<details><summary><b>Example Responses</b></summary>
|
|
|
|
|
|
|
|
```json
|
|
|
|
Success
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
Error
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
--- |
|
|
|
\ No newline at end of file |