Requires Java 17 Springboot Version 3.0.2 https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html
https://www.baeldung.com/install-maven-on-windows-linux-mac
To install project packages with maven
mvn clean install
https://www.docker.com/products/docker-desktop/
Build the Images
docker compose build
Run the docker container
docker compose up
If you want to build and run the container at the same time
docker compose up --build
For admin Username : admin Password : 12345678
For approver Username : approver Password : 87654321
Currently, PDFGenerator is only accessible through Postman via this link http://localhost:8080/api/form/generateForm/{formID}}
where the formID
must reside inside your MongoDB. You will need to either be authorised as an admin
or a mod
inorder to use it. To get authorised, the steps are
- Create an account with roles ["admin", "mod"] via
localhost:8080/api/auth/signup
with the following JSON body.
{
"username": "abc",
"password":12345,
"email":"test123@email.com",
"roles" : ["admin", "mod"]
}
- Sign in on postman via
localhost:8080/api/auth/signin
with following JSON body. You should see a response with youraccessToken
key-value field.
{
"username" : "abc",
"password":12345
}
-
Copy the contents of
accessToken
into Authorization tab. Switch from whatever it is to bearer token and paste in your access token. -
Send a GET request to
http://localhost:8080/api/form/generateForm/{formID}}
, making sure theformID
exists in your database. After that is done, the generated word file will be INSIDE your Docker container. In order to access it, open upcli
and paste in the followingdocker cp smartform:/form.docx ~/Desktop/form.docx
. Replace the second argument with the output destination.