0% found this document useful (0 votes)
6 views10 pages

Group 11 Task A Documentation

The document outlines the documentation for a web service application named Mujiki, designed for online food ordering, connecting restaurants and customers. It details the application's main functions, including restaurant and user management, implemented use cases, architecture, and instructions for building and running the application. Additionally, it provides sample REST requests for creating and searching for restaurants and users.

Uploaded by

quynh nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

Group 11 Task A Documentation

The document outlines the documentation for a web service application named Mujiki, designed for online food ordering, connecting restaurants and customers. It details the application's main functions, including restaurant and user management, implemented use cases, architecture, and instructions for building and running the application. Additionally, it provides sample REST requests for creating and searching for restaurants and users.

Uploaded by

quynh nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

CSCI318 Group Project

Task A – Documentation
Group 11

Minh Duy Le 7438321


Dai Phat Nguyen 7875083
Ngoc Thien Nhi Nguyen 7657973
Thanh Trung Nguyen 8048381
Table of Contents
Overview ...................................................................................................................... 1
General Information .................................................................................................. 1
Main Functions ......................................................................................................... 1
UML Diagram ............................................................................................................ 1
Implemented Use Cases ........................................................................................... 2
Architecture .............................................................................................................. 3
Instructions .................................................................................................................. 4
Building .................................................................................................................... 4
Running .................................................................................................................... 5
Sample REST Requests ................................................................................................. 6
Restaurant ................................................................................................................ 6
User .......................................................................................................................... 7

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

Figure 1 - Domain UML Diagram

Implemented Use Cases


Currently, the application has implemented some use cases around the Restaurant and
User classes.

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.

READ – Search and Filter Restaurants


Any user can search for registered restaurants on the platform and filter based on the
attributes mentioned above.

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.

READ – View Users


A user, with the current implementation, can view other users on the system.

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

Figure 2 - Output of the install command on Linux

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

The application should listen on HTTP port 8080.

Figure 3 - Output of a sample run on Linux

5
CSCI318 Group Project – Task A – Documentation
Group 11

Sample REST Requests


Restaurant
Create a New Restaurant
POST /api/restaurant

Parameters should be passed in the POST body as a JSON object.

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

Parameters should be passed as URL-encoded query strings.

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"

This will return a JSON list of all registered users:


[{"id":"2b12896c-a13a-4e35-be95-
0e5132f6afcd","username":"evanle","firstName":"Evan","lastName":"Le","email":"evan.le
@example.com","phone":"1234567890","role":"USER"},{"id":"79a3264e-9c06-4e50-bccc-
dc580b926c6d","username":"jasminewang","firstName":"Jasmine","lastName":"Wang","email
":"[email protected]","phone":"0987654321","role":"USER"},{"id":"c69183e6-
1562-4471-919a-
2af442b1e8bc","username":"newuser","firstName":"Duy","lastName":"Le","email":"duy.le@
gmail.com","phone":"1234567890","role":"USER"}]

You might also like