Just a simple service that use template pattern in a real world example.
For building and running the application you need:
[git clone https://github.com/Mauro2888/report-customers-service.git](https://github.com/Mauro2888/report-customers-service.git)
This will expose port 8081 in localhost. This will expose port 8083 in localhost for testing. Moreover, the application in dev redirect automatically to swagger UI
mvn quarkus:dev
The application uses an in-memory H2 database. You can access the console at https://localhost:8081/h2-console with the following credentials:
- username: sa
- password: sa
- Jdbc-url: jdbc:h2:mem:report
Open your browser and navigate to https://localhost:8081/q/swagger-ui
POST
: The endpoint provides a POST request that generates a report from customer data.
- Request example
{
"startDate": "2015-01-01",
"endDate": "2025-12-31",
"reportType": "JSON"
}
- Response example
[
{
"id": "116ef3c1-b76a-487b-9e3d-933dbf078694",
"name": "John Doe",
"address": "123 Main St",
"phoneNumber": "555-555-5555",
"createdAt": "2015-01-01"
},
{
"id": "01700a8e-a703-4f56-992a-44d2f1c584b1",
"name": "Jane Doe",
"address": "456 Main St",
"phoneNumber": "555-555-5555",
"createdAt": "2016-01-01"
}
]
reportType (enum: CSV, HTML, JSON, XML) startDate (format: date) endDate (format: date)
GET
: The endpoint provides a GET request that retrieves a list of all customer data.
- Response example
[
{
"address": "123 Main St",
"id": "116ef3c1-b76a-487b-9e3d-933dbf078694",
"name": "John Doe",
"phoneNumber": "555-555-5555"
}
]
POST
: The endpoint provides a POST request that saves a new customer.
- Request example
{
"name": "Luca Rossi",
"phoneNumber": "123-456-7890",
"address": "Via Roma, 123"
}
PATCH
: The /api/v1/customers/{id} endpoint provides a PATCH request that updates the customer address.
- Request example
- id (format: uuid)
{
"address": "Via Roma, 123"
}
- Response example
{
"address": "Via Roma, 123",
"id": "116ef3c1-b76a-487b-9e3d-933dbf078694",
"name": "John Doe",
"phoneNumber": "555-555-5555"
}