Skip to content

Commit

Permalink
Merge pull request #57 from danial117/server_dev_39
Browse files Browse the repository at this point in the history
initla commit
  • Loading branch information
danial117 authored Oct 19, 2024
2 parents 964fe08 + 282d9ea commit 9c9ede2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
18 changes: 17 additions & 1 deletion controllers/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ try{
const type = req.query?.type;
const name =req.query?.name
const brand =req.query?.brand
const productName =req.query?.productName
const category =req.query?.category

const skip = (page - 1) * limit;
Expand Down Expand Up @@ -133,6 +134,20 @@ else if(name){



}
else if(productName && brand){
const productsByBrand=await Product.find({name:new RegExp(productName, 'i'),brand:brand})
.select('productImage name brand options')
.limit(limit);

setTimeout(()=>
{
res.status(200).json(productsByBrand)

},1000
)


}

else
Expand Down Expand Up @@ -160,12 +175,13 @@ else if(name){
.limit(limit);



res.status(200).json(products)


}


}
catch(err){

Expand Down
Loading

0 comments on commit 9c9ede2

Please sign in to comment.