Group 11 Task A Documentation
Group 11 Task A Documentation
Task A – Documentation
Group 11
i
CSCI318 Group Project – Task A – Documentation
Group 11
Overview
General Information
The application is a web service providing server functionality for Mujiki, a solution in the
domain of online food ordering. This service aims to be a platform connecting restaurants
and customers.
Main Functions
Mujiki allows restaurants to establish an online presence. Owners can create profiles
detailing their restaurants’ names, descriptions, cuisine type, opening hours, address, and
contact details. They can also offer and manage food items, along with the offerings’ names,
description, price, category, and current availability.
Mujiki also provides customer-facing functionality. Users should be able to create their own
personal profiles. They can browse for restaurants and the available menus. Customers can
add menu items into a cart, then pay for this order through the system. This allows the
application to become the first choice when one has “no food”.
Apart from allowing convenient orders, Mujiki also improves customer engagement as a
feedback portal. Users can add feedback comments to the platform, and restaurant owners
can view those sent to their business.
UML Diagram
The diagram below shows the classes in the application’s problem domain, as well as their
attributes and relationships.
1
CSCI318 Group Project – Task A – Documentation
Group 11
Restaurant
CREATE – Create a New Restaurant
A restaurant owner can use the application to register their restaurant to Mujiki. They should
specify the business’s name, phone, email, opening hours, cuisine time, description, and a
password for the restaurant account.
2
CSCI318 Group Project – Task A – Documentation
Group 11
User
CREATE – Create a New User
A customer can create a new user profile. They can specify their username, password, and
their personal details, including the user’s name, email, and phone number.
More fine-grained filtering and access control will be added when the application has
authentication and authorization capabilities.
Architecture
The source code (src/main/java/com/csci318/mujiki) is organized into subdirectories, each
implementing a component of the application. The components together provide a layered
architecture.
API Layer
The Controllers folder contains controller classes implementing the API layer. These
classes directly handle REST requests and delegate them to the appropriate components of
the service layer.
Service Layer
Services
Code in the Services directory are domain services. Public interfaces are provided for the
rest of the application, providing a layer of abstraction. These interfaces are then
implemented in Services/Impl as concrete classes.
Entities
Classes defined in the Entities folder correspond to entities in the domain. These classes
also represent the format of the information stored in the database.
DTOs
Classes in the DTOs folder are Data Transfer Objects. These are views of domain classes
passed to and returned from the service layer.
Mappers
Mappers, located in the Mappers directory, are components responsible for converting
between entities and DTOs. They all implement a common generic Mapper interface.
3
CSCI318 Group Project – Task A – Documentation
Group 11
Data Access Layer
The data access layer is provided by classes in the Repositories directory. Declaration of a
repository allows the framework to abstract away the application’s data access. Custom
queries can also be declared to serve use cases related to the corresponding entity.
Miscellaneous
The remaining code represents helpers not belonging to a specific layer.
Configuration
Configurations contains settings provided to the framework.
Constants
Constants contains enumerations, mapping integer codes to symbolic names throughout
the codebase.
Exceptions
Exceptions contains code for error handling, including exception classes and exception
handler. These will become useful as the application gets extended.
Utils
Utils stores utilities used during development such as test database seeding.
Instructions
The instructions below assume bash on UNIX-like systems (Linux, macOS) and cmd.exe on
Windows.
Building
JDK
JDK 21 is required for building the project. After installation, to check the JDK version, run
the following command:
javac --version
The first number (major version) should appear as 21, indicating JDK 21:
javac 21.0.4
Maven
The project is built using Apache Maven. The software is not required to be pre-installed on
the development machine – the included Maven Wrapper (mvnw for UNIX-like OSes or
mvnw.cmd for Windows) will download and install the appropriate version of Maven, as well
as other dependencies. The tool will also conduct an initial build of the application.
4
CSCI318 Group Project – Task A – Documentation
Group 11
To install dependencies and build the application, invoke the wrapper using:
./mvnw install
Or, on Windows:
mvnw.cmd install
Running
To run, invoke the spring-boot:run operation using the Maven Wrapper:
./mvnw spring-boot:run
Or, on Windows:
mvnw.cmd spring-boot:run
5
CSCI318 Group Project – Task A – Documentation
Group 11
Sample request:
curl -X POST http://localhost:8080/api/restaurant \
-H "Content-Type: application/json" \
-d '{
"name": "Example Restaurant",
"phone": "123-456-7890",
"email": "[email protected]",
"password": "securepassword",
"openTime": "09:00:00",
"closeTime": "22:00:00",
"cuisine": "ITALIAN",
"description": "A fine dining Italian restaurant"
}'
Or, on Windows:
curl -X POST http://localhost:8080/api/restaurant ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"name\": \"Example Restaurant\",^
\"phone\": \"123-456-7890\",^
\"email\": \"[email protected]\",^
\"password\": \"securepassword\",^
\"openTime\": \"09:00:00\",^
\"closeTime\": \"22:00:00\",^
\"cuisine\": \"ITALIAN\",^
\"description\": \"A fine dining Italian restaurant\"^
}"
This should return a JSON object containing the newly created restaurant’s ID and
confirming the added details:
{"id":"1206985b-43ee-41d3-b886-f33d09faa903","restaurantName":"Example
Restaurant","restaurantPhone":"123-456-
7890","email":"[email protected]","cuisine":"ITALIAN","openTime":"09:00:00","
closeTime":"22:00:00","rating":null,"description":"A fine dining Italian
restaurant","opened":false}
6
CSCI318 Group Project – Task A – Documentation
Group 11
Search and Filter Restaurants
GET /api/restaurant/search
Sample request:
curl -X GET
"http://localhost:8080/api/restaurant/search?name=Example%20Restaurant&cuisine=&minRa
ting=&maxRating&opened=false"
This should return a JSON list containing the details of restaurants matching the query
criteria:
[{"id":"1206985b-43ee-41d3-b886-f33d09faa903","restaurantName":"Example
Restaurant","restaurantPhone":"123-456-
7890","email":"[email protected]","cuisine":"ITALIAN","openTime":"09:00:00","
closeTime":"22:00:00","rating":null,"description":"A fine dining Italian
restaurant","opened":false}]
User
Create a New User
POST /api/user/signup
Parameters (user details) should be passed in the POST body as a JSON object.
Sample request:
curl -X POST "http://localhost:8080/api/user/signup" \
-H "Content-Type: application/json" \
-d '{
"username": "newuser",
"password": "password123",
"firstName": "Duy",
"lastName": "Le",
"email": "[email protected]",
"phone": "1234567890"
}'
Or, on Windows:
7
CSCI318 Group Project – Task A – Documentation
Group 11
curl -X POST "http://localhost:8080/api/user/signup" ^
-H "Content-Type: application/json" ^
-d ^
"{^
\"username\": \"newuser\",^
\"password\": \"password123\",^
\"firstName\": \"Duy\",^
\"lastName\": \"Le\",^
\"email\": \"[email protected]\",^
\"phone\": \"1234567890\"^
}"
On success, this will return a JSON object containing the recorded user information,
including the generated UUID and assigned role:
{"id":"c69183e6-1562-4471-919a-
2af442b1e8bc","username":"newuser","firstName":"Duy","lastName":"Le","email":"duy.le@
gmail.com","phone":"1234567890","role":"USER"}
View Users
GET /api/user
This API currently takes no parameters. Future additions will be implemented as URL-
encoded queries.
Sample request:
curl -X GET "http://localhost:8080/api/user"