Skip to content

Divine-mercyx/GoSendeet-Assessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoSendeet Rider Tracking Service

This project is a small Java backend service that simulates rider tracking for a logistics platform.
It allows trips to be created, accepts rider location updates, calculates total distance travelled, provides a simple ETA, and enforces valid trip state transitions.


How to Run

Requirements

  • Java 17+
  • Maven

Start the service

./mvnw spring-boot:run

The application runs on:

http://localhost:8080

API Endpoints

Create a trip

POST /api/v1/trip

Response:

{
  "tripId": "uuid"
}

Update rider location

POST /api/v1/trip/{id}/location

Request body:

{
  "latitude": 6.5244,
  "longitude": 3.3792
}

Get trip details

GET /api/v1/trip/{id}

Returns the current trip state and tracking information.


Complete a trip

POST /api/v1/trip/{id}/complete

After completion, no further updates are allowed.


Trip Lifecycle

Trips follow a strict lifecycle:

CREATED → IN_PROGRESS → COMPLETED
  • Location updates are only allowed while a trip is in progress
  • Completed trips are immutable

All state rules are enforced at the domain level.


Distance Calculation

Distance is calculated incrementally using consecutive GPS coordinates.

Assumptions: - Straight-line distance between points - No road or traffic data - Accuracy is not the primary goal


ETA Calculation

ETA is estimated using average speed based on distance travelled over time.

Assumptions: - No traffic consideration - ETA is approximate, not exact


Error Handling

  • 404 Not Found for unknown trips
  • 400 Bad Request for invalid trip actions

Errors are returned in a consistent JSON format.


Tests

Tests cover core behavior such as: - Trip creation - Distance updates - Trip completion - Invalid state transitions


About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages