Open Moulikmnit opened 3 weeks ago
@Moulikmnit is attempting to deploy a commit to the Vivek Prajapati's projects Team on Vercel.
A member of the Team first needs to authorize it.
The changes introduce a new couponId
field to the Product
model, enhancing its schema. A new Express.js route is added to verify coupon codes, responding with appropriate status messages based on the validity of the coupon. Additionally, modifications to the DashboardCart
component allow users to input and validate coupon codes, improving user interaction. Dependency versions in package.json
are updated to the latest compatible versions.
File | Change Summary |
---|---|
backend/models/Product.js | Added new field couponId (string, required, unique) to productSchema . |
backend/routes/verify-coupon.js | Introduced POST route /verify-coupon for coupon validation; includes error handling. |
package.json | Updated versions for react and react-dom from ^18.2.0 to ^18.3.1 . |
src/User/pages/Dashboard/dashboard-cart.jsx | Added couponCode state; implemented validateCoupon method for coupon validation; updated UI. |
DashboardCart
component, which is relevant to the new couponId
field introduced in the main PR's Product
model, as both pertain to coupon functionality within the application.good first issue
, gssoc
, hacktoberfest
, hacktoberfest-accepted
, gssoc-ext
🐇 In the garden of code, we play,
New coupons sprout, bright as day.
With routes to verify, oh what fun,
A cart with discounts, everyone!
So hop along, let's validate,
In this code, we'll celebrate! 🎉
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Triggering an alert/error message to prompt users to re-enter the code
So basically I have done two types of changes Backend - In the models folder in the MongoDB schema I have created how the schema should be structured. Created a separate file in Route folder where I have checked whether the coupon code is valid or not
Frontend - In the Dashboard portion I have added the functionality to call the function for backend and then returning an alert if the answer is coming out to be wrong
Fixes Issue
Instead of not responding to any messages which is displayed when incorrect coupon code is entered instead an error message is now thrown.
Changes proposed
Created schema for coupon ID model In Route folder verify whether the coupon is valid or not Changes are done in frontend portion to call the function in the backend
Screenshots
Note to reviewers
Plese see if I have done correct changes I tried my best it was my first time sir
Summary by CodeRabbit
New Features
Bug Fixes
Dependencies