A monorepo for all Mujiki codebases. Each codebase is included as a git submodule.
The instructions below assume bash on UNIX-like systems (Linux, macOS) and cmd.exe on Windows.
JDK 21 is required for building the project.
Make sure you pass the --recursive flag when cloning this repo to include all submodules.
git clone --recursive https://github.com/csci318-online-food/mujiki-orderingFor each microservice, the bundled Maven Wrapper (mvnw) needs to be invoked in order to install
dependencies and build the application.
cd $name-service
./mvnw install
cd ..Or, on Windows:
cd %name%-service
mvnw.cmd install
cd ..(Replace $name or %name% with the name of each microservice).
Before running this project, Kafka needs to be installed and running. The project includes a helper
script, kafka_run, to download a configured version of Apache Kafka then run Zookeeper and Kafka
servers in the background.
./kafka_run.shOr, on Windows:
kafka_run.cmdSimilarly, the spring-boot:run operation needs to be invoked for each microservice to run the
system.
cd $name-service
./mvnw spring-boot:run
cd ..Or, on Windows:
cd %name%-service
mvnw.cmd spring-boot:run
cd ..Alternatively, building and running can be done in one command using the provided run scripts.
./run.shOr, on Windows:
run.cmdThe application should occupy HTTP ports 8080 - 8089.
These are cURL commands runnable from the terminal to test the application's functionality.
Since UUIDs are randomly generated on each run, they will not match the sample requests shown below.
When testing, please take note of the returned objects' UUIDs (the id field) and substitute
those into subsequent requests.
A Postman collection is also available. With support for automatic UUID extraction into environment variables, the tool can make testing much more convenient.
Alternatively, the Demo Client can be used to test the system's use cases.
When evaluating the application, it is recommended to run the commands in the order they are presented.
Please refer to the report for a detailed explanation of each request parameter.
curl -L 'http://localhost:8080/api/auth/user/signup' \
-H 'Content-Type: application/json' \
--data-raw '{
"username":"nhi0412",
"password": "password1",
"firstName": "Nhi",
"lastName": "Nguyen",
"email": "nhin0412@gmail.com",
"phone": "12345627890"
}
'Or, on Windows:
curl -L "http://localhost:8080/api/auth/user/signup" ^
-H "Content-Type: application/json" ^
--data-raw ^
"{^
\"username\":\"nhi0412\",^
\"password\": \"password1\",^
\"firstName\": \"Nhi\",^
\"lastName\": \"Nguyen\",^
\"email\": \"nhin0412@gmail.com\",^
\"phone\": \"12345627890\"^
}^
"curl -L "http://localhost:8081/api/user"curl -L "http://localhost:8081/api/user/nhi0412"curl -L 'http://localhost:8080/api/auth/restaurant/signup' \
-H 'Content-Type: application/json' \
--data-raw '{
"name": "Chat Thai",
"phone": {
"countryCode": "+61",
"number": "1112223333"
},
"email": "chat.thai1@example.com",
"password": "passchathai",
"cuisine": "THAI",
"openTime": "10:00:00",
"closeTime": "22:00:00",
"description": "Authentic Thai cuisine"
}
'Or, on Windows:
curl -L "http://localhost:8080/api/auth/restaurant/signup" ^
-H "Content-Type: application/json" ^
--data-raw ^
"{^
\"name\": \"Chat Thai\",^
\"phone\": {^
\"countryCode\": \"+61\",^
\"number\": \"1112223333\"^
},^
\"email\": \"chat.thai1@example.com\",^
\"password\": \"passchathai\",^
\"cuisine\": \"THAI\",^
\"openTime\": \"10:00:00\",^
\"closeTime\": \"22:00:00\",^
\"description\": \"Authentic Thai cuisine\"^
}^
"curl -L "http://localhost:8082/api/restaurant"curl -L -X PUT 'http://localhost:8082/api/restaurant/1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433' \
-H 'Content-Type: application/json' \
--data-raw '{
"name": "Chat Thai V2 (new V2)",
"phone": {
"countryCode": "+61",
"number": "1112223333"
},
"email": "chat.thai2@example.com",
"password" : "pass",
"cuisine": "THAI",
"openTime": "10:00:00",
"closeTime": "22:00:00",
"description": "Authentic Thai cuisine"
}
'Or, on Windows:
curl -L -X PUT "http://localhost:8082/api/restaurant/1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433" ^
-H "Content-Type: application/json" ^
--data-raw ^
"{^
\"name\": \"Chat Thai V2 (new V2)\",^
\"phone\": {^
\"countryCode\": \"+61\",^
\"number\": \"1112223333\"^
},^
\"email\": \"chat.thai2@example.com\",^
\"password\" : \"pass\",^
\"cuisine\": \"THAI\",^
\"openTime\": \"10:00:00\",^
\"closeTime\": \"22:00:00\",^
\"description\": \"Authentic Thai cuisine\"^
}^
"curl -L 'http://localhost:8086/api/address/forUser/93242ebf-52dc-4f6a-8e52-7f31f1ad089e' \
-H 'Content-Type: application/json' \
-d '{
"street": "68A Smith St",
"suburb": "Wollongong",
"state": "NSW",
"postcode": 2500,
"country": "Australia"
}
'Or, on Windows:
curl -L "http://localhost:8086/api/address/forUser/93242ebf-52dc-4f6a-8e52-7f31f1ad089e" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"street\": \"68A Smith St\",^
\"suburb\": \"Wollongong\",^
\"state\": \"NSW\",^
\"postcode\": 2500,^
\"country\": \"Australia\"^
}^
"curl -L "http://localhost:8086/api/address/forUser/93242ebf-52dc-4f6a-8e52-7f31f1ad089e"curl -L 'http://localhost:8086/api/address/forRestaurant/1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433' \
-H 'Content-Type: application/json' \
-d '{
"street": "91 Market St",
"suburb": "Wollongong",
"state": "NSW",
"postcode": 2500,
"country": "Australia"
}
'Or, on Windows:
curl -L "http://localhost:8086/api/address/forRestaurant/1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"street\": \"91 Market St\",^
\"suburb\": \"Wollongong\",^
\"state\": \"NSW\",^
\"postcode\": 2500,^
\"country\": \"Australia\"^
}^
"curl -L "http://localhost:8086/api/address/forRestaurant/1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433"curl -L "http://localhost:8082/api/restaurant/search?cuisine=THAI&postcode=2500"curl -L 'http://localhost:8082/api/item/create?restaurantId=1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433' \
-H 'Content-Type: application/json' \
-d '{
"name": "Fried Chicken with Mushroom Sauce",
"description": "Fried chick with fresh mushroom collected from Aussie farm",
"price": 12.99,
"availability": true
}
'Or, on Windows:
curl -L "http://localhost:8082/api/item/create?restaurantId=1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"name\": \"Fried Chicken with Mushroom Sauce\",^
\"description\": \"Fried chick with fresh mushroom collected from Aussie farm\",^
\"price\": 12.99,^
\"availability\": true^
}^
"curl -L 'http://localhost:8082/api/promotion/create' \
-H 'Content-Type: application/json' \
-d '{
"restaurantId": "1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433",
"code": "SUMMER",
"description": "Summer Sale",
"percentage": 20,
"expiryDate": "2025-01-01T00:00:00",
"active": true,
"stock": 420
}
'Or, on Windows:
curl -L "http://localhost:8082/api/promotion/create" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"restaurantId\": \"1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433\",^
\"code\": \"SUMMER\",^
\"description\": \"Summer Sale\",^
\"percentage\": 20,^
\"expiryDate\": \"2025-01-01T00:00:00\",^
\"active\": true,^
\"stock\": 420^
}^
"curl -L "http://localhost:8082/api/promotion/a369f23d-b951-40d6-a40d-e5c742957c78"curl -L "http://localhost:8082/api/promotion/restaurant/1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433"curl -L 'http://localhost:8084/api/feedback/create' \
-H 'Content-Type: application/json' \
-d '{
"restaurantId": "1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433",
"userId": "93242ebf-52dc-4f6a-8e52-7f31f1ad089e",
"rating": 1,
"comments": "This is good"
}
'Or, on Windows:
curl -L "http://localhost:8084/api/feedback/create" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"restaurantId\": \"1d2f4e73-47c6-4aeb-92ae-4d0fbdb6b433\",^
\"userId\": \"93242ebf-52dc-4f6a-8e52-7f31f1ad089e\",^
\"rating\": 1,^
\"comments\": \"This is good\"^
}^
"curl -L 'http://localhost:8087/api/payment' \
-H 'Content-Type: application/json' \
-d '{
"userId": "93242ebf-52dc-4f6a-8e52-7f31f1ad089e",
"holderName" : "Nguyen Thanh Trung",
"cardNumber" : "42424-2424-2424-2424"
}
'Or, on Windows:
curl -L "http://localhost:8087/api/payment" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"userId\": \"93242ebf-52dc-4f6a-8e52-7f31f1ad089e\",^
\"holderName\" : \"Nguyen Thanh Trung\",^
\"cardNumber\" : \"42424-2424-2424-2424\"^
}^
"
curl -L "http://localhost:8087/api/payment/user/93242ebf-52dc-4f6a-8e52-7f31f1ad089e"This use case requires the following to be run first to get a cartId.
curl -L 'http://localhost:8083/api/cart' \
-H 'Content-Type: application/json' \
-d '{
"userId": "93242ebf-52dc-4f6a-8e52-7f31f1ad089e"
}
'Or, on Windows:
curl -L "http://localhost:8083/api/cart" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"userId\": \"93242ebf-52dc-4f6a-8e52-7f31f1ad089e\"^
}^
"curl -L 'http://localhost:8083/api/cart/a0e8878d-1d29-443c-a99d-6222eff82f45/items' \
-H 'Content-Type: application/json' \
-d '{
"restaurantId": "a0e8878d-1d29-443c-a99d-6222eff82f45",
"itemId" : "a65ce87e-966d-41cf-b665-f7058e0540ef"
}'Or, on Windows:
curl -L "http://localhost:8083/api/cart/a0e8878d-1d29-443c-a99d-6222eff82f45/items" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"restaurantId\": \"a0e8878d-1d29-443c-a99d-6222eff82f45\",^
\"itemId\" : \"a65ce87e-966d-41cf-b665-f7058e0540ef\"^
}"curl -L -X POST "http://localhost:8083/api/cart/process-order/a0e8878d-1d29-443c-a99d-6222eff82f45?paymentId=fd039734-6b27-409d-b0aa-1de2d1bf59c2&promotionId=a369f23d-b951-40d6-a40d-e5c742957c78"curl -L -X POST "http://localhost:8088/api/order/4fe1f583-cd74-4ea8-a001-47ab9a82f672/status?orderStatus=COMPLETED"This use case requires the following to be run first to get a loyaltyId.
Ideally this should be run before Use Case 11, before the user has
created an order. If the order has already been completed, it is still possible to re-run use cases
10 through 12.
curl -L 'http://localhost:8081/api/loyalty/enroll' \
-H 'Content-Type: application/json' \
-d '{
"userId": "93242ebf-52dc-4f6a-8e52-7f31f1ad089e"
}
'Or, on Windows:
curl -L "http://localhost:8081/api/loyalty/enroll" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"userId\": \"93242ebf-52dc-4f6a-8e52-7f31f1ad089e\"^
}^
"curl -L "http://localhost:8081/api/loyalty/6a3941ed-61b1-451a-8406-10181df378f1"curl -L "http://localhost:8089/api/analytics/ratings"curl -L "http://localhost:8089/api/analytics/orders"