You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.1 KiB
Markdown

2 years ago
# Mx Leaderboard API Docs
## /user
src/user/user.controller
### GET /user
Returns a list of all users as User[]
## /auth
src/auth/auth.controller
### POST /register
@Request
```json
{
"name": "user's name",
"email": "email@user.com",
"password": "user's password"
}
```
@Response
HTTP 201 Created OR HTTP 400 Bad Request
### POST /login
@Request
```json
{
"email": "email@user.com",
"password": "user's password"
}
```
@Response
```json
{
"access_token": "<authentication token generated by server>"
}
```
## /rank
src/rank/rank.controller
NOTE: @Authenticated: set authentication header with the jwt token.
### GET /
@Response
Returns the rank leaderboard as Rank[]
### GET /:userId
@Authenticated
@Response
Returns the user's current score as Rank
### GET /:userId/all
@Authenticated
@Response
Returns the user's rank history as Rank[]
### POST /add20
@Authenticated
@Response
Returns new Rank with updated score +20
### POST /add60
@Authenticated
@Response
Returns new Rank with updated score +60
### POST /add100
@Authenticated
@Response
Returns new Rank with updated score +100