The system registers postal items - letters, parcels - their movement between post offices, as well as provides information on the entire history of movement of a particular postal item.
- Java
- Spring Boot, Spring Data JPA (to work with entities)
- PostgreSQL (main DBMS for this project)
- Maven (package manager to manipulate with dependecies)
- Flyway(for migration with database)
- Lombok
- ModelMapper (for mapping models to and from dto)
- JUnit5 and Mockito (for testing)
1. Clone the application
git clone https://github.com/notas4int/test-task-mail-delivery.git
2. Create PostgreSQL database
create database mail-delivery
3. Change PostreSQL username and password as per your installation
- open
src/main/resources/application.properties
- change
spring.datasource.username
andspring.datasource.password
as per your PostgreSQL installation
4. Run the app using maven
mvn spring-boot:run
The app will start running at http://localhost:8080
Method | Url | Decription | Sample Valid Request Type |
---|---|---|---|
POST | /api/mail/register-postal-item | add new postal item | registrationRequest |
PATCH | /api/mail/add-post-office | add post office and change status to 'in_the_post_office' | postOfficeAddingRequest |
PATCH | /api/mail/left-postal-item/{id} | change status to 'en_route' by id | |
GET | /api/mail/check-postal-item/{id} | get status and movement history by id and return postalItemResponse | |
PATCH | /api/mail/receive-postal-item/{id} | change status to 'receive' by id |
{
"mailType": "PARCEL",
"personIndex": 342,
"address": "Mira 23",
"personName": "Vova",
"postOfficeId": 1
}
{
"id": 1,
"postOfficeId": 2
}
{
"mailStatus": "EN_ROUTE",
"postOffices": [
{
"id": 2,
"name": "Post office the second",
"address": "Veteranov 3"
},
{
"id": 1,
"name": "Post office first",
"address": "Mira 23"
}
]
}