Skip to content

pwalaszkowski/tennisclub_java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Table of Contents

Overview

This is just simple Tennis Club application for master studies project. This application allow you to add new player then use added players to add tennis match result.

Be aware that database is empty at the beginning and it's starts
as fresh for every new launch of application to manage this change 
properties parameter: spring.jpa.hibernate.ddl-auto=create-drop

Tech Stack

  • Java 17
  • Spring Boot 3.4.1
  • Thymeleaf + CSS
  • H2 Database (database is automatically drop after stop the application)

Running Application

cd club
./mvnw spring-boot:run

Functions

The application allow you to add new player and use added player to use this in matches results.

Welcome Screen

img.png

Players Screen

img_1.png

img_2.png

Matches Screen

img_3.png

404 Error Screen

img.png

Endpoints:

Players Endpoints

PlayerController

Base Path: /players

HTTP Method Endpoint Description
GET /players/new Display the form for adding a new player.
GET /players/{id}/delete Delete a player.

Matches Endpoints

Base Path: /matches

HTTP Method Endpoint Description
GET /matches/new Display the form for adding a new match.
GET /matches/{id} Edit an existing match.
POST /matches/{id} Update an existing match.
GET /matches/{id}/delete Delete a match.

Example Requests/Responses

  • GET /players/{id}/delete
GET http://localhost:8080/players/456/delete HTTP/1.1
{
    "message": "Player deleted successfully",
    "playerId": 456
}
  • GET /matches/{id}
GET http://localhost:8080/matches/123 HTTP/1.1
{
    "id": 123,
    "player1": "John Doe",
    "player2": "Jane Smith",
    "date": "2025-01-01",
    "score": "6-4, 7-5"
}
  • POST /matches/{id}
POST http://localhost:8080/matches/123 HTTP/1.1
Content-Type: application/json

{
    "player1": "John Doe",
    "player2": "Jane Smith",
    "date": "2025-01-01",
    "score": "6-4, 7-5"
}
{
    "message": "Match updated successfully",
    "updatedMatch": {
        "id": 123,
        "player1": "John Doe",
        "player2": "Jane Smith",
        "date": "2025-01-01",
        "score": "6-4, 7-5"
    }
}
  • GET /matches/{id}/delete
GET http://localhost:8080/matches/123/delete HTTP/1.1
{
    "message": "Match deleted successfully",
    "matchId": 123
}

Database access:

http://localhost:8080/h2-console

Fill in the connection details on the H2 Console login page:

  • JDBC URL: jdbc:h2:mem:tennisdb

    • tennisdb is the name of your in-memory database, as configured in your application.properties.
  • Username: sa (default username for H2).

  • Password: password

img_4.png

Executing queries:

img_5.png

img_6.png

About

Tennis Club Application written using Java, Spring and Thymeleaf

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors