Commit 332ee410 authored by 박상호's avatar 박상호 🎼
Browse files

Merge remote-tracking branch 'origin/jiwon' into sangho

parents e6a926ac 523a4677
......@@ -60,7 +60,7 @@ const recommendPro = async (req, res) => {
'products.productId': mongoose.Types.ObjectId(productId)
}
},
{ "$unwind": "$products" },
{ $unwind: "$products" },
{
$group: {
_id: "$products.productId",
......
......@@ -98,6 +98,19 @@ const categoryId = async (req, res, next, category) => {
}
}
const sortingProduct = async (req,res) =>{
try {
const productslist = await Product.find({ main_category: category })
const length = productslist.length
req.length = length
const productsPiece = await Product.find({ main_category: category }).skip((req.query.page - 1) * per).limit(per)
req.productsPiece = productsPiece
} catch (error) {
}
}
const subname = async (req, res) => {
const per = 9;
try {
......
......@@ -84,7 +84,7 @@ const addorder = async (req, res) => {
const order = await Order.find({ userId: userId }).populate({
path: 'products.productId',
model: 'Product'
})
}).sort({createdAt:-1})
res.status(200).json(order)
} catch (error) {
console.log(error)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment