diff --git a/README.md b/README.md index 8219cfa..18f6b29 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,60 @@ Generally the app should be ran through a docker container or docker-compose fil the `./docker` folder. Images get built in the `CI` environment when a tag is pushed to the repository. + +### Getting Started + +When the application is first launched an admin user should be created in the running container. +Attach to the container using `docker exec` or `docker compose exec`, then run: + +``` +./App generate-admin --username "admin" --password "super-secret --confirmPassword "super-secret" +``` + +You can then login and generate user, employees, vendors, etc. + +After the setup has been completed, then you should generate a mock purchase order and set the `id` +to the value you would like new purchase orders to start from. This should be done through calling +the api, as the web interface does not allow users to enter an id value. + +#### Example + +These examples use `httpie`, note the port is used for local development, in a production +environment you would just use the FQDN of where the application is running. + +**Login** + +``` +http :8080/api/v1/login username="admin" password="super-secret" \ + | jq '.["token"]' \ + | pbcopy +``` + +**Set the token as environment variable** + +``` +export API_TOKEN= +``` + +**Get the employees to copy an id to use for the purchase order** + +``` +http -A bearer -a "$API_TOKEN" :8080/api/v1/employees +``` + +**Get the vendor branches to copy an id to use for the purchase order** + +``` +http -A bearer -a "$API_TOKEN" :8080/api/v1/vendors/branches +``` + +**Generate first po** + +``` +http -A bearer -a "$API_TOKEN" :8080/api/v1/purchase-orders \ + id:="60000" \ + materials="Test" \ + customer="Testy McTestface" \ + createdForID="" + vendorBranchID="" +```