- This project demonstrates a Spring Boot application for managing courier travel data. It logs courier locations, tracks travel distances, and manages interactions with stores within a specific radius.
- The application incorporates various design patterns including Facade, Builder, and Strategy patterns, and provides endpoints for logging locations, retrieving travel data, and querying total travel distances.
- Logging Courier Locations:
- The application logs a courier's location details (time, latitude, longitude) whenever they enter within a 100-meter radius of a Store.
- Reentries within one minute to the same store are not counted.
- Querying Travel Data:
- It provides endpoints to retrieve past travel data of couriers.
- Includes filtering by store name and time range.
- Calculating Travel Distances:
- The application can calculate and return the total travel distance covered by a courier.
Endpoints Summary
Method | Url | Description | Request Body | Path Variable | Response |
---|---|---|---|---|---|
POST | /api/couriers/log-location | Log courier's location. | LogCourierLocationRequest | None | CustomResponse<String> |
GET | /api/couriers/travels/{courierId} | Get past travels of a courier by courier ID. | None | courierId (UUID) | CustomResponse<List<CourierResponse>> |
GET | /api/couriers/travels | Get travels of a courier by courier ID, store name, and time range. | TravelQueryRequest | None | CustomResponse<List<CourierResponse>> |
GET | /api/couriers/travels/{courierId}/total-distance | Get total travel distance of a courier by courier ID. | None | courierId (UUID) | CustomResponse<String> |
- Kotlin
- Spring Boot 3.0
- Restful API
- Mapstruct
- Open Api (Swagger)
- Gradle
- Junit5
- Mockito
- Integration Tests
- Docker
- Docker Compose
- CI/CD (Github Actions)
- Postman
- TestContainer
- MySQL
Import postman collection under postman_collection folder
DATABASE_USERNAME={DATABASE_USERNAME}
DATABASE_PASSWORD={DATABASE_PASSWORD}
http://localhost:1231/swagger-ui/index.html
- Gradle or Docker
The application can be built and run by the Docker
engine. The Dockerfile
has multistage build, so you do not need to build and run separately.
Please follow directions shown below in order to build and run the application with Docker Compose file;
$ cd couriertracking
$ docker-compose up -d
If you change anything in the project and run it on Docker, you can also use this command shown below
$ cd couriertracking
$ docker-compose up --build
To build and run the application with Gradle
, please follow the directions shown below;
$ cd couriertracking
$ ./gradlew clean build
$ ./gradlew bootRun
https://hub.docker.com/repository/docker/noyandocker/couriertracking/general