- corretto cancellazione ordine
This commit is contained in:
@@ -19,7 +19,7 @@ const Order = require('../models/order');
|
||||
const Variant = require('../models/variant');
|
||||
const { User } = require('../models/user');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
/*const Department = require('../models/Department')
|
||||
const Category = require('../models/Category')
|
||||
@@ -489,20 +489,6 @@ router.post('/:userId/gestord', authenticate, async function (req, res, next) {
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
$or: [
|
||||
{
|
||||
'gasordine.active': true,
|
||||
},
|
||||
{
|
||||
gasordine: {
|
||||
$exists: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
$or: [
|
||||
@@ -519,6 +505,21 @@ router.post('/:userId/gestord', authenticate, async function (req, res, next) {
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: "orderscarts",
|
||||
localField: "_id",
|
||||
foreignField: "items.order",
|
||||
as: "matchingOrders",
|
||||
},
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
"matchingOrders": {
|
||||
$ne: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: '$product._id',
|
||||
|
||||
Reference in New Issue
Block a user