Storage of sports team and players data
Version: 0.0.1
-
Install Docker
-
Download deploy file
-
Execute the command
"docker compose -f ^path to downloaded file^ up"
-
Install JRE 8
-
Install PostgresQL
-
Download LiderIt.jar
-
Excecute:
"java -jar LiderIt.jar ^user^ ^password^>"
if you don't want automatically generated bd:
-
Execute createUser.sql
-
Execute createDB.sql
-
Execute:
"java -jar LiderIt.jar"
Swagger: https://app.swaggerhub.com/apis/MOROZOWAU/REST/1.0.0
Alternative:
TEAMS:
PLAYERS:
SERVER:
GET /sports/teams
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 204 | empty |
- Response example{1}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 1 | Barcelona | Football | 1899-11-29 |
| 2 | Avangard | Hockey | 1950-11-07 |
GET /sport/teams/filters/sport-kinds
- Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| sportKind | String(query) | True | Kind of sport | Football |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 204 | empty |
- Response example{1}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 1 | Barcelona | Football | 1899-11-29 |
| 2 | Manchester United | Football | 1879-01-01 |
GET /sport/teams/filters/dates
-
Description:
Get teams created between startDate and endDate
-
Parameters:
| Name | Type | Required | Description | Example | Format |
|---|---|---|---|---|---|
| startDate | String(query) | True | From date | 1800-01-01 | 'yyyy-MM-dd' |
| endDate | String(query) | True | To date | 2000-01-01 | 'yyyy-MM-dd' |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 204 | empty |
| 3 | 400 | application/json |
| 4 | 400 | application/json |
- Response example{1}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 1 | Barcelona | Football | 1899-11-29 |
| 2 | Manchester United | Football | 1879-01-01 |
| 3 | Avangard | Hockey | 1950-11-07 |
- Response example{3}:
| message | date |
|---|---|
| The endDate cannot be earlier than the startDate [2100-01-01, 2200-01-01] | 2023-03-21T02:56:20.368 |
- Response example{4}:
| message | date | description |
|---|---|---|
| Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDate'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDate] for value '220-01-01'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [220-01-01] | 2023-03-21T03:38:00.79 | 220-01-01: incorrect format. Format must be 'yyyy-MM-dd' |
POST /sports/teams
- Request body:
| name | sportKind | creationDate |
|---|---|---|
| Barcelona | Football | 1899-11-29 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 201 | application/json |
| 2 | 400 | empty |
- Response example{1}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 1 | Barcelona | Football | 1899-11-29 |
PUT /sports/teams/{teamId}
-
Description:
Add team if teamId not found or change team info
-
Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| teamId | Integer(path) | True | Numeric id of the team to get | 1 |
- Request body:
| name | sportKind | creationDate |
|---|---|---|
| Barcelona | Football | 1899-11-29 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 201 | application/json |
| 3 | 400 | empty |
- Response example{1}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 1 | Barcelona | Football | 1899-11-29 |
- Response example{2}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 2 | Barcelona | Football | 1899-11-29 |
DELETE /sports/teams/{teamId}
- Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| teamId | Integer(path) | True | Numeric id of the team to get | 1 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 204 | empty |
| 2 | 404 | application/json |
- Response example{2}:
| message | date |
|---|---|
| Team with id:1 not found | 2023-03-21T02:56:20.368 |
GET /sports/players/{teamId}
-
Description:
If team found, return list of players in team
-
Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| teamId | Integer(path) | True | Numeric ID of the team to get | 1 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 204 | empty |
| 3 | 404 | application/json |
- Response example{1}:
| id | name | surname | birthDate | role |
|---|---|---|---|---|
| 1 | Ander | Astralaga | 2004-03-03 | Goalkeeper |
| 2 | Arnau | Tenas | 2001-05-30 | Goalkeeper |
- Response example{3}:
| message | date |
|---|---|
| Team with id:100 not found | 2023-03-21T04:24:28.745 |
GET /sports/players/{teamId}/filters/roles
-
Description:
If team found get all players and filters them by role
-
Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| role | String(query) | True | Name of role | Goalkeeper |
| teamId | Integer(path) | True | Numeric ID of the team to get | 1 |
- Request body:
| name | surname | birthDate | role |
|---|---|---|---|
| Ander | Astralaga | 2004-03-03 | Goalkeeper |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 201 | application/json |
| 2 | 404 | application/json |
- Response example{1}:
| id | name | surname | birthDate | role |
|---|---|---|---|---|
| 1 | Ander | Astralaga | 2004-03-03 | Goalkeeper |
- Response example{2}:
| message | date |
|---|---|
| Team with id:1 not found | 2023-03-21T02:56:20.368 |
POST /sports/players/{playerId}
-
Description:
If team found, post player to it.
-
Request body:
| name | surname | birthDate | role |
|---|---|---|---|
| Ander | Astralaga | 2004-03-03 | Goalkeeper |
- Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| teamId | Integer(path) | True | Numeric ID of the team to get | 1 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 201 | application/json |
| 2 | 404 | application/json |
- Response example{1}:
| id | name | surname | birthDate | role |
|---|---|---|---|---|
| 1 | Ander | Astralaga | 2004-03-03 | Goalkeeper |
- Response example{2}:
| message | date |
|---|---|
| Team with id:1 not found | 2023-03-21T02:56:20.368 |
PATCH /sports/players/{playerId}
-
Description:
If team found and player found changes player team.
-
Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| newTeamId | Integer(query) | True | Numeric ID of new team to player | 2 |
| playerId | Integer(path) | True | Numeric ID of the player to get | 1 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 400 | application/json |
- Response example{1}:
| id | name | sportKind | creationDate |
|---|---|---|---|
| 2 | Manchester United | Football | 1879-01-01 |
- Response example{2}:
| message | date |
|---|---|
| Team with id:1 not found | 2023-03-21T02:56:20.368 |
PUT /sports/players/{playerId}
-
Description:
Change player information. Don't create player, if not found by id
-
Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| playerId | Integer(path) | True | Numeric ID of the player to get | 1 |
- Request body:
| name | surname | birthDate | role |
|---|---|---|---|
| Ander | Astralaga | 2004-03-03 | Goalkeeper |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 200 | application/json |
| 2 | 404 | application/json |
- Response example{1}:
| id | name | surname | birthDate | role |
|---|---|---|---|---|
| 1 | Ander | Astralaga | 2004-03-03 | Goalkeeper |
- Response example{2}:
| message | date |
|---|---|
| Player with id:1 not found | 2023-03-21T02:56:20.368 |
DELETE /sports/players/{playerId}
- Parameters:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| playerId | Integer(path) | True | Numeric ID of the player to get | 1 |
- Responses:
| Index | Code | Response Body |
|---|---|---|
| 1 | 204 | empty |
| 2 | 404 | application/json |
- Response example{2}:
| message | date |
|---|---|
| Player with id:1 not found | 2023-03-21T02:56:20.368 |