Professional Documents
Culture Documents
Tys Project
Tys Project
By
2019-GCUF-08753
2019-GCUF-07330
Thesis submitted in partial fulfillment
Bachelor OF SCIENCE
IN
INFORMATION TECHNOLOGY
GC UNIVERSITY, FAISALABAD
August 2023
i
DECLARATION
I carry the work reported in this project under the supervision of Dr, Muhammad Younas,
Lecturer, Department of Information Technology, Government College University, and Faisalabad
Pakistan. I hereby declare that my project, “Online Bakery Store” and all its contents that
include Software are the product of my research. I further declare that this work has not been
submitted for the award of any other degree diploma. The University has all rights to take into
action if the information provided is found inaccurate at any stage.
2019-GCUF-08753
2019-GCUF-07330
ii
CERTIFICATE BY THE PROJECT SUPERVISOR
It is to certify that Muhammad Shoaib Aslam , Muhammad Arslan Shah under Roll
no. 17113,17036 and Registration No. 2019-GCUF-08753 , 2019-GCUF-07330 has completed
his Final Year Project named as “Online Bakery Store” for Government College University,
Faisalabad, at the Department of Information Technology to fulfill the partial requirement of the
degree of Bachelorof Science in Information Technology, BS(IT).
Supervisor
Name:
Signature:
Designation with Stamp:
Name:
Signature:
Designation with Stamp:
Name:
Signature:
Designation with Stamp:
Chairperson
Name:
Signature:
Designation with Stamp:
iii
DEDICATED
TO
&
iv
ACKNOWLEDGEMENT
First and foremost, all prayers go to ALLAH, I find no words to define my heartiest
sense of gratitude to the Almighty ALLAH, the Most Generous Compassionate, and
Beneficent, and to Prophet MUHAMMAD (SAW), Who is the best light of guidance
for whole humanity from dawn to dusk. I am so much thankful to ALLAH by whom
Grace and Blessings I completed my project on time.
I am also grateful to my loving parents for their encouragement and all sort of
moral, social, and financial support not only in my academic career but also in all other
aspects of life. Their prayers were incessant and enabled me to reach this stage. I am
also thankful to all my family and my grandparents for their kindness, love and
eversupporting prayers.
I truly acknowledge the cooperation and help of my Supervisor Mr. Afzal
Hussain Lecturer, Department of Information Technology, and Government College
University Faisalabad. He has been of consistent help, motivation, and guidance
throughout this project. He has been a great source of guidelines throughout this project.
I also feel great honor to express my sincere and cordial thanks to Dr. Maryam
Rehman (Head of the Department) for her invaluable inspiration and healthy
criticism towards handling the project effectively and comprehensively.
I express my gratitude towards Dr. Sheraz Malik, Professor of Government
College University Faisalabad, under whose kind and scholastic guidance, keen interest
and constant encouragement.
At last, but not least, special thanks to all the developer's communities
throughout the entire Internet for tirelessly resolving the issues and helping and
providing guidance to my queries and problems in the development of the software and
resolving issues in the hardware.
Words are very important to convey thoughts and thanks; the words are
impossible to find to thanks my father and whole family for their prayers and
encouragement for us and for our work.
v
Contents
CHAPTER-1.................................................................................................................................................1
Introduction................................................................................................................................................1
Stakeholders...............................................................................................................................................1
System Model............................................................................................................................................2
Functional Requirments.............................................................................................................................3
Non-functional Requirements..................................................................................................................14
CHAPTER-2 ANALYSIS...........................................................................................................15
Use case model....................................................................................................................................15
System Sequence Diagram (SSD) of each use case............................................................................17
Domain class diagram..........................................................................................................................18
CHAPTER-3 DESIGN..............................................................................................................................19
Design class diagram...........................................................................................................................19
Sequence Diagrams of each SSD.......................................................................................................20
Description of Bakery Use Case in Fully Dressed Format..................................................................15
Bakery login.........................................................................................................................................15
Add a new/update/delete product............................................................
Customer login.......................................................................................
Select getagory...................................................................................................................................21
CHAPTER-4 IMPLEMENTATION.......................................................................................................23
Coding/Algorithm..............................................................................................................................26
Navbar...............................................................................................................................................26
Home code.........................................................................................................................................29
Registration.........................................................................................................................................33
Login...................................................................................................................................................41
Cards code..........................................................................................................................................57
Cart code.............................................................................................................................................59
Item code............................................................................................................................................62
Items code...........................................................................................................................................65
Category filter code..............................................................................................................................68
CHAPTER-5 TESTING...........................................................................................................................70
Test Case..............................................................................................................................................70
Test Case: Login case..........................................................................................................................70
Test Case: Registration case.................................................................................................71
Introduction
Creating a website you stop being invisible to the people trying to find you online. More
and more studies are telling us about the ROBO effect where customers are learning to
research online before buying offline. They are typing their problems or needs into the
search engine of their choice and are researching the organization that appear for those
queries. If you do not have a Web presence, there is no chance of you showing up and you
never even enter into their thought process. In 2016, you cannot afford to be invisible.
Stakeholders
Manufacturers
Make products and do not sell most directly to the public. Instead, they sell in bulk to
wholesalers and retailers. Buying directly from the manufacturer is the cheapest way to
buy products for resale, but most have minimum purchase requirements that you will
need to meet. You will also need to stock and reship products when selling to customers.
For these reasons, it is often easier to buy directly from a wholesaler.
Wholesalers
Wholesalers buy products in bulk from manufacturers, mark them up slightly and then
sell them to retailers for resale to the public. If they have minimal purchases, they are
usually much less than a manufacturer needs. Wholesalers typically stock products from
dozens - if not hundreds - of manufacturers and tend to operate in a specific industry or
niche. Most are strictly wholesale operators, meaning they only sell to retailers and not
directly to the public.
Retailer
A retailer is someone who sells products directly to the public at a markup. If you run an
e- commerce business, simply put, you are a retailer. Customer - A customer is your
customer! They are the people who browse your store, and buy your stuff! Treat them like
royalty.
System Model
1. Users
2. Admin
1
1. Users
In this module:
2. Admin
In this module:
• Login/Logout
• Admin will add/delete/update the products
Functional Requirement
Various functional modules can be implemented by the system. It provides an overview of
the system requirement.
Maintenance:
It is the system, which maintains the description of the products and their classification
characteristics (size, weight, cost etc.) Following are the two main components of
Maintenance.
Product:
It contains product information, item number, size, categories etc. It is also the vendor or
seller's admin where they can add product information to websites.
Price:
Transaction:
2
A transaction is a payment method in which money is transferred for the purchase of
products. This process is secure and password protected. The three steps involved in an
online transaction are registration, ordering, and payment.
Stock Report:
Order Report:
List of products that the customer can purchase. Who can buy?
Delivery Report:
Registration:
User must be registered if he wants to buy the product, unregistered user cannot go to
shopping cart.
Login:
User login to the system by entering valid user id and password for purchase.
Cart Changes:
Cart changes means after login or registration the user can order or cancel the product
from the shopping cart.
Logout:
3
Requirement Name: Maintenance
Originator: Admin
Fit Criterion:
Customer 8 Customer 2
Satisfaction: Dissatisfaction:
Supporting
Materials:
History:
Table1.2: Maintenance
4
Originator: Admin
Fit Criterion: price, speed of delivery, availability of service, where it's made
Customer Customer 3
Satisfaction: Dissatisfaction:
Priority: Conflicts:
3 Nil
Supporting NA
Materials:
History:
Table1.3: Product
Requirement Name: Price
Requirement #: Req06 Requirement Type: Functional
Rationale:
Originator: Admin
Fit Criterion:
5
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Supporting
Materials:
NA
History: NILL
Table1.4: Price
Originator: User
Customer Customer
Satisfaction: Dissatisfaction:
7 3
6
Priority: Conflicts:
3 Nil
Supporting
Materials:
NA
History:
NILL
Table1.5: Transaction
Rationale:
Originator: User
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Priority: Conflicts:
3 Nil
Supporting
Materials:
NA
7
History:
NILL
Table1.6: Stock Report
Originator:
Customer 9 Customer 1
Satisfaction: Dissatisfaction:
Supporting NA
Materials:
History: NA
8
Requirement Name: Delivery Report
Requirement #: Req06 Requirement Type: Functional
Rationale:
Originator: Admin
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Priority: Conflicts:
3 Nil
Supporting
Materials: NA
History:
NILL
9
Requirement #: Req06 Requirement Type: Functional
Rationale:
Originator: Admin
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Supporting NA
Materials:
History:
Table1.9: Registration
1
Description: This requirement User login to the system by entering valid
user id and password for purchase.
Rationale:
Originator: Admin
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Priority: Conflicts:
3 Nil
Supporting
Materials:
NA
History:
NILL
Table1.10: Login
1
Description: Cart changes means after login or registration the user can
order or cancel the product from the shopping cart.
Originator: Admin
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Priority: Conflicts:
3 Nil
Supporting
Materials:
NA
History:
NILL
Table1.11: Cart changes
Originator: Admin
1
Fit Criterion: When requested
Customer Customer
Satisfaction: Dissatisfaction:
7 3
Priority: Conflicts:
3 Nil
Supporting
Materials:
NA
History:
NILL
Table1.12: Logout
Nonfunctional Requirement
There are many other types of NFRs, all of which can have a significant impact on the
performance, scalability, and usability of your e-commerce platform. These include:
Security – defining the level of security that must be met such as the OWASP Top 10
Privacy – meeting the basic requirements for GDPR Scalability
Performance – ensuring that the system can handle expected traffic and Able to meet
order volume during normal and peak hours. Key User Journey
Velocity – Defining how long each step along the key user journey will take.
1
Web Services Speed – Specifying how long web services will take to respond.
Accessibility – Ensuring that the platform meets basic accessibility standards.
Documentation – Ensuring that the platform is well documented.
Quality – Even the best e-commerce platforms can be misused so you must insist that
the code is developed to a good standard.
Extensibility – Ensuring that the platform can be extended in a way that allows for
future growth. Data integrity.
Retention – specifying how long data must be stored and how data integrity is
maintained.
Testing – Defining how unit testing will be built into the solution.
Compatibility – Ensuring that the platform can easily integrate with third-party
systems.
Search - Specifying how quickly the system will return search results.
Availability - defining the agreed uptime of the platform under normal conditions
Infrastructure - defining the performance limits of the infrastructure (CPU and
memory usage
1
CHAPTER-2 ANALYSIS
Web Customer actor uses some web site to make purchases online. Top-level use
cases are View Items, Make Purchase and Client Register. View Items use case could
use by customer as top-level use case if customer only wants to find and see some
products. This use case could also use as a part of Make Purchase use case. Client
Register use case allows customer to register on the web site, for example to get some
coupons or be invited to private sales. Note, that Checkout use case is included use
case not available by itself - checkout is part of making purchase
Except for the Web Customer actor, several other actors will described below with
detailed use cases.
View Items use case is extended by several optional use cases - customer may search for
items, browse catalog, view items recommended for him/her, add items to shopping cart
1
or wish list. All these use cases are extending use cases because they provide some
optional functions allowing customer to find item.
Customer Authentication use case is included in View Recommended Items and Add
to Wish List because both require the customer to authenticate. At the same time, item
could added to the shopping cart without user authentication.
System Sequence Diagram (SSD) of each use case
1
Domain class diagram
Each customer has unique id and linked to exactly one account. Account owns shopping
cart and orders. Customer could register as a web user to be able to buy items online.
Customer is not required to be a web user because purchases could also made by phone or
by ordering from catalogues. Web user has login name, which also serves as unique id.
Web user could be in several states - new, active, temporary blocked, or banned, and
linked to a shopping cart. Shopping cart belongs to account.
Account owns customer orders. Customer may have no orders. Customer orders are
sorted and unique. Each order could refer to several payments, possibly none. Every
payment has unique id and related to exactly one account.
Each order has current order status. Both order and shopping cart have line items linked
to a specific product. Each line item related to exactly one product. A product could be
associated to many line items or no item at all.
1
CHAPTER-3 DESIGN
1
Sequence Diagrams of each SSD
1
UC Name User Login
Actor (s)
Stakeholders
Preconditions Customer must know his/her email and Password before login to
the system.
Extensions If the email and password is wrong than show error message
according to error.
Special requirements User remember his/her email and Password for login.
2
Frequency of Login to the Bakery Multiple times in a day.
Occurrence
Stakeholders
2
2-add, update and delete
records
Extensions If not add, update or delete records .No error massage will
appear.
Stakeholders customer
Preconditions user must remember his/her email and Password which provide
in registration form
2
Main Success Action Response
Scenario
2. Entered email and
password in form and
press login button
Extensions If the email and password is wrong than return into login page,
and show error message.
2
Actor (s) Customer
Stakeholders Admin/Customer
panel successfully
3-
Frequency of User can login multiple times in a day and can check his fee
Occurrence status.
2
CHAPTER-4 Implementation
Navbar Coding
"../../components/categoryfilter/Categoryfilter";
{ axios
.get("http://localhost:5000/api/v1/auth/me", {
headers: {
},
2
})
.then((response) =>
{ dispatch(setUser(response?.data?.data
));
})
.catch((error) =>
{ toast.error(error.message);
});
}, []);
return (
<>
<div className="container-fluid">
</a>
<li className="nav-item">
Home
</Link>
2
</a>
</li>
<Categoryfilter />
<li className="nav-item">
About
</a>
</li>
<li className="nav-item">
Contact Us
</a>
</li>
</ul>
<div className="user-name">
</div>
<form className="d-flex"></form>
<Link
to="/cart"
>
2
<div className="count ms-2">{total_quantity ?? 0}</div>
</Link>
</div>
</div>
</nav>
</>
); }; export default
Header;
Home Code
2
const Home = () => {
);
useEffect(() =>
{ getCategories();
}, []);
return (
<div className="home-page">
<Header />
<div className="banner-page">
<div className="">
<img
src="../assests/images/bannerr.jpg"
className="banner-page"
/>
</div>
</div>
</div>
2
{filteredCategories?.map((category) => {
return (
<>
{category?.variants?.map((variant) => {
})}
</div>
</>
)}
</div>
);
})}
</div>
);
};
3
Registration Code
"./registration.css";
3
import { setLoggedIn, setToken } from "../../redux-toolkit/slices/authSlice";
[state, setState] =
?? 0);
} setState((prev)
=> { return {
...prev,
[name]: value,
};
});
};
3
register(state, setLoading)
.then((res) =>
{ dispatch(setLoggedIn(true));
dispatch(setToken(res?.data?.token));
toast.success("Registered Successfully!");
history("/home");
})
.catch((error) => {
console.log(error);
toast.error(error.message);
setLoading(false);
});
e.preventDefault();
}; return (
<h2 className="text-center">Register</h2>
<input type="text"
id="first_name"
name="first_name"
3
className="form-control"
value={state.first_name}
onChange={changeState}
/>
</div>
<input type="text"
id="last_name"
name="last_name"
className="form-control"
value={state.last_name}
onChange={changeState}
/>
</div>
<label htmlFor="email">Email</label>
<input type="email"
id="email" name="email"
className="form-control"
value={state.email}
onChange={changeState}
/>
</div>
3
<label htmlFor="city">City</label>
<input type="text"
id="city" name="city"
className="form-control"
value={state.city}
onChange={changeState}
/>
</div>
<input type="password"
id="password"
name="password"
className="form-control"
value={state.password}
onChange={changeState}
/>
</div>
<input type="password"
id="cpassword"
name="cpassword"
className="form-control"
value={state.cpassword}
onChange={changeState}
3
/>
</div>
</div>
Register
</button>
</form>
</div>
); }; export default
Registration;
Server
require("../models/User");
3
// @access Public
email, city,
password,
role,
});
});
3
Login
"react-hot-toast";
import "./login.css";
3
const Login = () => { const [state, setState] =
...prev,
[name]: value,
};
});
};
login(state, setLoading)
.then((res) =>
{ dispatch(setLoggedIn(true));
dispatch(setToken(res?.data?.token));
toast.success("Logged In Successfully!");
history("/home");
})
setLoading(false);
});
3
e.preventDefault();
};
return (
<label htmlFor="email">Email</label>
<input type="email"
id="email" name="email"
className="form-control"
value={state.email}
onChange={changeState}
/>
</div>
<label htmlFor="password">Password</label>
<input type="password"
id="password"
name="password"
className="form-control mb-
2" value={state.password}
onChange={changeState}
4
/>
Forget password
</a>
</div>
>
Sign in
</button>
</div>
</form>
</div>
); }; export default
Login;
4
// @access Public
user.matchPassword(password);
credentials", 401));
});
4
// @desc Update user details
// @access Private
};
});
res.status(200).json({
user,
});
});
// @access Private
User.findById(req.user.id).select("+password");
4
// Check current password if (!(await
user.matchPassword(req.body.currentPassword))) { return
user.password = req.body.newPassword;
await user.save();
});
// @access Public
email", 404));
user.getResetPasswordToken();
4
await user.save({ validateBeforeSave: false });
`${req.protocol}://${req.get(
"host"
)}/api/v1/auth/resetpassword/${resetToken}`;
const message = `You are receiving this email because you (or someone else) has
requested the reset of a password. Please make a PUT request to: \n\n ${resetUrl}`;
});
user.resetPasswordToken = undefined;
user.resetPasswordExpire = undefined;
4
res.status(200).json({
success: true,
data: user,
});
});
// @access Public
resetPasswordToken = crypto
.createHash("sha256")
.update(req.params.resettoken)
.digest("hex");
User.findOne({ resetPasswordToken,
});
token", 400));
4
// Set new password
user.password = req.body.password;
user.resetPasswordToken = undefined;
user.resetPasswordExpire = undefined;
await user.save();
});
user.getSignedJwtToken();
const options =
{ expires: new
Date(
),
httpOnly: true,
};
{ options.secure = true;
}
4
res.status(statusCode).cookie("token", token, options).json({
});
};
require("../models/Category");
// @access Public
req.params.categoryId });
return
res.status(200).json({
variants.length,
4
data: variants,
});
} else
{ res.status(200).json(res.advancedResult
s);
});
// @access Public
});
id of ${req.params.id}`),
404
);
res.status(200).json({
success: true,
4
data: course,
4
});
});
// @access Private
{ req.body.category = req.params.categoryId;
${req.params.bootcampId}`),
404
);
res.status(200).json({ suc
cess: true,
data: variant,
});
5
});
// @access Private
id of ${req.params.id}`),
404
);
});
res.status(200).json({ suc
cess: true,
data: variant,
});
});
5
// @desc Delete variant
// @access Private
id of ${req.params.id}`),
404
);
await variant.remove();
res.status(200).json({
{},
});
});
5
Cards Code
dispatch(setsingleItem(variant));
history(`/items/${variant._id}`);
5
};
return (
<div className="image-container">
{variant?.image == 'no-photo.jpg' ? (
<img
src="./assests/images/cake.jpg
height="150px"
className="card-image"
/>
):(
<img
src={variant?.image}
alt="" width="280px"
height="150px"
className="card-
image"
/>
)}
</div>
<div className="title">{variant?.title}</div>
</div>
5
<div className="description-row mt-2">{variant?.description}</div>
</div>
);
};
Cart Code
import { decreaseQuantity,
increaseQuantity,
import "./cart.css";
5
const Cart = ({ item }) => {
return (
{item?.image == "no-photo.jpg" ? (
<img
src="../assests/images/cake.jpg
height="auto"
className="cart-image"
/>
):(
<img
src={item?.image}
alt="" width="auto"
height="auto"
className="cart-
image"
/>
)}
</div>
<div className="cart-title">{item?.title}</div>
5
<div className="quantity-row w-100 d-flex align-items-center justify-
contentend">
dispatch(decreaseQuantity(item?._id))}
>
</button>
<div className="quantity">{item?.quantity}</div>
dispatch(increaseQuantity(item?._id))}
>
</button>
</div>
</div>
</div>
);
};
5
Item Code
{ dispatch(addItem(variant));
};
return (
<div className="item-page">
5
<Header />
{variant?.image == "no-photo.jpg" ? (
<img
src="../assests/images/cake6.jpg"
alt="" width="auto"
height="auto"
className="item-image"
/>
):(
<img
src={variant?.image}
alt="" width="auto"
height="auto"
className="item-
image"
/>
)}
</div>
<div className="item-title">{variant?.title}</div>
<div className="item-description">{variant?.description}</div>
5
<button className="btn btn-primary add-to-
handleAddToCart(variant)}
>
Add to Cart
</button>
</div>
</div>
</div>
</div>
);
};
Items Code
import "./items.css";
return (
6
<div className="home-page">
<Card />
<Card />
<Card />
<Card />
<Card />
<Card />
<Card />
</div>
</div>
</div>
); }; export
default Item;
6
const CartPage = () => { const navigate = useNavigate();
placeOrders(body, setOrderPlaced);
};
return (
<div className="cart-page">
<Header />
})}
>
Place Order
</button>
</div>
</div>
6
</div>
);
};
);
dispatch(setFilterCatgories(filteredCategories));
};
return (
6
<div className="dropdown">
toggle="dropdown"
>
Category
</button>
<ul className="dropdown-menu">
{allCategories?.map((category) => {
return (
handleCategoryChange(category?._id)}
key={category?._id} >
{category?.title}
</li>
);
})}
</ul>
</div>
);
6
CHAPTER-5 TESTING
Test Case
Test Cases
Test Case: User Login
Test Case #: 1 Test Case Name: User login
Short Enter User email and password in the login form and press login
Description: button.
version System
6
1 T-T-P User email Khannasee Successfully Successfu Pass Test is
and mabbas59 login lly login pass
password
0@gmail.c
om
123456
2 T-T-F User email Khannasee Not login Not login Pass Test is
and mabbas59 pass
password 0@gmail.c
om 123
Table: Login
Comments
Short Description: Check all the text boxes, radio buttons, buttons, etc.
6
Operating System: Windows 10 Professional Environment: React
6
Short Description: User can filter the categories
Pre-Condition:
Comments
6
Test Case: Add to cart
Test Case #: 4 Test Case Name: Items add to cart
Pre-Condition:
6
2 T-T-F Place Detail Error Error Pass Test
post Message Message is
Pass
Comments