Skip to content

Commit

Permalink
added feature quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshusachan112 committed Oct 22, 2024
1 parent 9e43546 commit 2211054
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Backend/controllers/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ require("dotenv").config();
exports.productrequest=async (req,res)=>{
try{
const {id,email}=req.user;
const {buyername, selleremail, productid}=req.body;
const {buyername, selleremail, productid, quantity}=req.body;
const buyeremail=email;
if(!buyeremail || !selleremail || !productid || !buyername){
if(!buyeremail || !selleremail || !productid || !buyername || !quantity){
return res.json({
success:false,
message:"All Fields are required"
Expand Down Expand Up @@ -49,11 +49,12 @@ exports.productrequest=async (req,res)=>{
})
}

const mailresposne=await mailsender(selleremail,"Request to Sell",requestproduct(buyername, sellerdata.firstname + " " + sellerdata.lastname, productdata.productname, productid));
const mailresposne=await mailsender(selleremail,"Request to Sell",requestproduct(buyername, sellerdata.firstname + " " + sellerdata.lastname, productdata.productname, productid, quantity));
const saverequest=await Request.create({
buyer:id,
seller:sellerdata._id,
product:productdata._id,
quantity:quantity
})

res.json({
Expand Down Expand Up @@ -113,7 +114,7 @@ exports.shedulemeet=async (req,res)=>{


const buyername=requestdata.buyer.firstname + " " + requestdata.buyer.lastname;
const mailresposne=await mailsender(requestdata.buyer.email,"Shedule Venue",shedulevenue(buyername, sellername, productdata.productname, productid,venue, date ,time ));
const mailresposne=await mailsender(requestdata.buyer.email,"Shedule Venue",shedulevenue(buyername, sellername, productdata.productname, productid,venue, date ,time, requestdata.quantity));

const saveshedule=await Shedule.create({
requestid:requestid,
Expand Down
3 changes: 2 additions & 1 deletion Backend/mailtemplates/Request.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports.requestproduct=(buyername ,sellername, productname, productid)=>{
exports.requestproduct=(buyername ,sellername, productname, productid, quantity)=>{
return `<DOCTYPE html>
<html>
<head>
Expand All @@ -13,6 +13,7 @@ exports.requestproduct=(buyername ,sellername, productname, productid)=>{
<body>
<div>
Quantities ${quantity}
Hey ${sellername} you got a request from ${buyername} to sell your product ${productname}
Product id ${productid}
Kindly visit to the website to sell it.
Expand Down
4 changes: 4 additions & 0 deletions Backend/models/Request.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const requestschema=new mongoose.Schema({
type:Date,
default:Date.now,
},
quantity:{
type : String,
required:true
}
})


Expand Down

0 comments on commit 2211054

Please sign in to comment.