Skip to content

braduran/soccer-quarkus-api

Repository files navigation

Soccer API

API that allow us manage live and history soccer matches.
Java version: 21
Framework: quarkus
Database: H2

It uses the next quarkus extensions:

  • Hibernate ORM with Panache
  • H2 (Inmemory DB)
  • Hibernate Validator
  • Reactive Jackson
  • Reactive JSON-B

Running locally

  1. Clone repository
  2. Run application into cloned repository:
  • Windows

./gradlew.bat quarkusDev

  • Linux

./gradlew quarkusDev

  1. Postman collection in src/main/resources/soccer api_collection.json

Enpoints

1. Create match

POST http://localhost:8080/match/create

{
    "local": "Barcelona",
    "visitor": "Milan",
    "stadium": "Camp nou",
    "competition": "Champions",
    "attendeesNumber": 25000,
    "date": "2024-09-01"
}

Response

{
  "attendeesNumber": 25000,
  "competition": "Champions",
  "date": "2024-09-01",
  "local": "Barcelona",
  "minute": 0,
  "stadium": "Camp nou",
  "state": "START",
  "visitor": "Milan"
}

2. Update match

PUT http://localhost:8080/match/update

{
      "local": "Barcelona",
      "visitor": "Milan",
      "date": "2024-09-01",
      "localScore": 1,
      "visitorScore": 0,
      "minutes": 20,
      "state": "IN_PROGRESS"
}

Response

{
  "attendeesNumber": 25000,
  "competition": "Champions",
  "date": "2024-09-01",
  "local": "Barcelona",
  "minute": 20,
  "stadium": "Camp nou",
  "state": "IN_PROGRESS",
  "visitor": "Milan"
}

3. List matches

GET http://localhost:8080/match/list

Response

[
  {
    "attendeesNumber": 25000,
    "competition": "Champions",
    "date": "2024-09-01",
    "local": "Barcelona",
    "minute": 20,
    "stadium": "Camp nou",
    "state": "IN_PROGRESS",
    "visitor": "Milan"
  }
  ...
]

4. Filter matches by state

GET http://localhost:8080/match/state
params: state=IN_PROGRESS

Response

[
  {
    "attendeesNumber": 25000,
    "competition": "Champions",
    "date": "2024-09-01",
    "local": "Barcelona",
    "minute": 20,
    "stadium": "Camp nou",
    "state": "IN_PROGRESS",
    "visitor": "Milan"
  }
  ...
]

5. History of team matches

GET http://localhost:8080/match/team
params: team=Milan&page=1

Response

{
  "page": 1,
  "totalPages": 2,
  "data": [
    {
      "attendeesNumber": 25000,
      "competition": "Champions",
      "date": "2024-09-01",
      "id": 1,
      "local": "Barcelona",
      "localScore": 1,
      "minutes": 20,
      "stadium": "Camp nou",
      "state": "IN_PROGRESS",
      "visitor": "Milan",
      "visitorScore": 0
    }
    ...
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages