Build the jar file
mvn clean install
Option 1: Run with jar file
java -jar target/invoice-manager-0.0.1-SNAPSHOT.jar
Option 2: Run with docker
Build the docker image
docker build -t invoice-manager-app .
Run the docker image
docker run -p 8080:8080 invoice-manager-app
After running the app, you can access the swagger at http://localhost:8080/swagger-ui/index.html
Or you can import Postman export: file://InvoiceManagerApp.postman_collection.json
Login and get the token:
curl --location 'http://localhost:8080/v1/auth/login' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Cookie: JSESSIONID=F82067AB4DCCB593ABC45B100374261F' \
--data-raw '{
"email": "[email protected]",
"password": "password1"
}'
Create an invoice: Get the token from the login response and replace {{token}} with the token or use the "admin" token
curl --location 'http://localhost:8080/v1/invoice' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {{token}}' \
--header 'Cookie: JSESSIONID=F82067AB4DCCB593ABC45B100374261F' \
--data '{
"firstName": "json",
"lastName": "data",
"email": "[email protected]",
"amount": 100.0,
"billNo": "TR001"
}'
Create a product: Get the token from the login response and replace {{token}} with the token or use the "admin" token
curl --location 'http://localhost:8080/v1/product' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {{token}}' \
--header 'Cookie: JSESSIONID=F82067AB4DCCB593ABC45B100374261F' \
--data '{
"name": "Product1"
}'
Get products: Get the token from the login response and replace {{token}} with the token or use the "admin" token
curl --location 'http://localhost:8080/v1/product' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {{token}}' \
--header 'Cookie: JSESSIONID=F82067AB4DCCB593ABC45B100374261F'
Query all activities:
curl --location 'http://localhost:8080/v1/activity' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {{token}}' \
--header 'Cookie: JSESSIONID=DD8B0CB8EC9A9F3820C92C7C71FBAB79'
Query activities by status:
curl --location 'http://localhost:8080/v1/activity/status/SUCCESS' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {{token}}' \
--header 'Cookie: JSESSIONID=DD8B0CB8EC9A9F3820C92C7C71FBAB79'
You can find other api endpoints in the swagger documentation or postman collection.