- 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>> |
POST | /api/couriers/travels/{courierId} | Get travels of a courier by courier ID, store name, and time range. | TravelQueryRequest | courierId (UUID) | 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> |
- Java 21
- Spring Boot 3.0
- Restful API
- Mapstruct
- Open Api (Swagger)
- Maven
- 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:1226/swagger-ui/index.html
- Maven 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 migroscouriertracking
$ 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 migroscouriertracking
$ docker-compose up --build
To build and run the application with Maven
, please follow the directions shown below;
$ cd migroscouriertracking
$ mvn clean install
$ mvn spring-boot:run
https://hub.docker.com/repository/docker/noyandocker/migroscouriertracking/general