A visitors log microservice application that logs visitors visiting an organization. The service is written in Java Spring boot and containerized with docker.
The Service exposes these endpoints:
a. POST /login - takes username and password
b. POST /staff - Adds new staff - should take staff_name, phone_number, email_address and address
c. GET /staff - Gets all Staff
d. GET /staff/{id} - Get specific Staff
e. POST /visitor - Adds new visitor - should take visitor_name, phone_number, email_address and address
f. GET /visitors - Get visitors
g. GET /visitor/{id} - Get specific visitor
h. POST /visit - Logs new visit – should take visitor_id, staff_id, date_of_visit, reason_for_visit
Set JAVA_HOME Set M2_HOME Add M2_HOME/bin to the execution path
Clone the project to your machine.
Run the tests - Kindly ensure the database is up and listening and the 'visitorservice' schema is created as described down in this readme.
mvn test
mvn package -DskipTests
docker-compose up
docker ps
docker exec -it docker-mysql bash
mysql> CREATE USER 'mysql.infoschema'@'localhost' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec)
mysql> GRANT SELECT ON *.* TO `mysql.infoschema`@`localhost`; Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> CREATE database visitorservice; Query OK, 0 rows affected, 1 warning (0.00 sec)
That's pretty much it. You can enter the shell of the running app to confirm it is running fine.
docker exec -t -i visitorslog-docker /bin/bash
Find the swagger documentation here.