Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
shopping-mall
Commits
332ee410
Commit
332ee410
authored
Feb 01, 2021
by
박상호
🎼
Browse files
Merge remote-tracking branch 'origin/jiwon' into sangho
parents
e6a926ac
523a4677
Changes
83
Hide whitespace changes
Inline
Side-by-side
server/controllers/order.controller.js
View file @
332ee410
...
@@ -60,7 +60,7 @@ const recommendPro = async (req, res) => {
...
@@ -60,7 +60,7 @@ const recommendPro = async (req, res) => {
'
products.productId
'
:
mongoose
.
Types
.
ObjectId
(
productId
)
'
products.productId
'
:
mongoose
.
Types
.
ObjectId
(
productId
)
}
}
},
},
{
"
$unwind
"
:
"
$products
"
},
{
$unwind
:
"
$products
"
},
{
{
$group
:
{
$group
:
{
_id
:
"
$products.productId
"
,
_id
:
"
$products.productId
"
,
...
...
server/controllers/product.controller.js
View file @
332ee410
...
@@ -98,6 +98,19 @@ const categoryId = async (req, res, next, category) => {
...
@@ -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
subname
=
async
(
req
,
res
)
=>
{
const
per
=
9
;
const
per
=
9
;
try
{
try
{
...
...
server/controllers/user.controller.js
View file @
332ee410
...
@@ -84,7 +84,7 @@ const addorder = async (req, res) => {
...
@@ -84,7 +84,7 @@ const addorder = async (req, res) => {
const
order
=
await
Order
.
find
({
userId
:
userId
}).
populate
({
const
order
=
await
Order
.
find
({
userId
:
userId
}).
populate
({
path
:
'
products.productId
'
,
path
:
'
products.productId
'
,
model
:
'
Product
'
model
:
'
Product
'
})
})
.
sort
({
createdAt
:
-
1
})
res
.
status
(
200
).
json
(
order
)
res
.
status
(
200
).
json
(
order
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
...
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment