Skip to content

justanothercoder-hub/GymTrack_Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏋️ GymTrack Demo Backend

A Spring Boot REST API for managing gym customers and tracking their workout sessions. This project demonstrates a One-to-Many relationship where a single Customer can have multiple Workout records.

🚀 Features

  • Customer Management: Create and view customers.
  • Workout Tracking: Log workouts (sets, reps, day) linked specifically to a customer.
  • Relational Data: Uses JPA/Hibernate to link Workouts to Customers via a Foreign Key (worker_id).
  • CRUD Operations: Full support for Creating, Reading, Updating, and Deleting workouts.

🛠️ Tech Stack

  • Language: Java
  • Framework: Spring Boot (Web, JPA)
  • Database: MySQL (configured via application.properties)
  • Build Tool: Maven

🔌 API Endpoints

1. Customers (/customers)

Manage the people using the gym.

Method URL Description
GET /customers Get a list of all customers
POST /customers Register a new customer

🧪 How to Test with Postman

Since this is a backend application, you will use Postman to send requests.

1. Create a Customer (The User)

  1. Open Postman and create a new request.
  2. Set the method to POST.
  3. URL: http://localhost:8080/customers
  4. Go to Body tab → Select raw → Select JSON (from the dropdown).
  5. Paste this JSON:
    {
        "firstName": "Samik",
        "lastName": "Coder"
    }
    
    
    

How to Add a Workout (POST)

To log a workout, you must link it to an existing Customer ID.

  1. Open Postman and create a new request.
  2. Set the request method to POST.
  3. Enter the URL: http://localhost:8080/workouts
  4. Go to the Body tab → Select raw → Choose JSON from the dropdown list.
  5. Paste the following JSON payload:
{
    "customerId": 1,
    "exerciseName": "Bench Press",
    "day": 1,
    "sets": 3,
    "reps": 12
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages