# PA165 Soccer Manager




## How to run server
make sure that you use java 11
```console
git clone https://gitlab.fi.muni.cz/xadamec1/sportClub.git
cd sportClub (go into the folder sportClub)
mvn clean install
cd soccer-manager-mvc
mvn spring-boot:run 
```
## How to run client
install node.js with node package manager
```console
cd sportClub (go into the folder sportClub)
mvn clean install
cd frontend/soccer-manager/
npm install
npm start

```
## API 
API is documented by swagger, for access to API you must:
1. start the server (step by step guide is above)
2. go to http://localhost:8080/swagger-ui/index.html
3. for sending the request is necessary to authorize to swagger with a bearer token, a token can be obtained by visiting http://localhost:8080/swagger-ui/index.html#/Auth%20/loginForSwagger and filling the request body with this for admin:
 ```json
 {
   "userId": 0,
   "userName": "tita",
   "password": "1234"
 }
 ```
 for user use this 
  ```json
 {
   "userId": 0,
   "userName": "TamTen",
   "password": "1234"
 }
 ```
 4. Then click on authorize button on top of the page and paste there the bearer token
 5. Now you can easily try every API endpoint by clicking on the endpoint using the button try it
## About Project



**Members:**
- _485584	Adamec, Petr  - Team Leader
- 506549	Koshchienko, Stanislav
- 514699	Bortsov, Vitalii
- 527362	Balazy, Petr

***
**Assignment:**

Several human players (at least two) can manage their soccer teams out of a list of real soccer teams of several championships across Europe. Human players can pick their team and add / remove soccer players from a list of available free agents. There is a schedule of games and results will be generated taking into account the players’ characteristics (no need to have some advanced algorithm simulating games: just a simple randomization will do it!). Admin can put new soccer players in the main list of free agents and change their attributes before they are selected by other human players. If you want, you can implement a budget system for each team, so that players can be bought and sold based on the financial availability of teams.
***

## Roles

System has two authorization roles - **Admin** and **User**.

- Admin is role for managing system e.g. CRUD player, CRUD team
- User role is connected to specific team, which he can manage and plays with them leagues. 


## Entities


- **Player** - entity representing soccer player
- **Team** - entity representing a list of players, 
- **League** - Superior league, where users login to win this league
- **Championship** - entity represent competion which team plays in real world (Premier League, National League)
- **User** - entity represent user administration 
- **Match** - entity represent match from our league




# Diagrams
**Use case diagram**
![](Diagrams/Use_Case_Diagram.jpg)

**Class Diagram**
![](Diagrams/Class_Diagram.jpg)

