- Modifiche a ProductInfo... Continua

This commit is contained in:
Surya Paolo
2025-08-29 23:34:08 +02:00
parent 2ee710b748
commit fcbc64cea8
24 changed files with 1006 additions and 1010 deletions

View File

@@ -168,20 +168,6 @@ module.exports.findAllIdApp = async function (idapp) {
as: 'product',
},
},
{
$lookup: {
from: 'productinfos',
localField: 'product.idProduct',
foreignField: '_id',
as: 'product.productInfo',
},
},
{
$unwind: {
path: '$product.productInfo',
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'producers',
@@ -358,20 +344,6 @@ module.exports.getTotalOrderById = async function (id) {
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'productinfos',
localField: 'product.idProductInfo',
foreignField: '_id',
as: 'product.productInfo',
},
},
{
$unwind: {
path: '$product.productInfo',
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'producers',
@@ -637,19 +609,6 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'productinfos',
localField: 'product.idProductInfo',
foreignField: '_id',
as: 'productInfo',
},
},
{
$unwind: {
path: '$productInfo',
},
},
{
$lookup: {
from: 'gasordines',
@@ -682,8 +641,8 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
{
$group: {
_id: '$product._id',
name: { $first: '$productInfo.name' },
weight: { $first: '$productInfo.weight' },
name: { $first: '$product.productInfo.name' },
weight: { $first: '$product.productInfo.weight' },
price_acquistato: { $first: '$product.price_acquistato' },
totalQuantity: { $sum: { $add: ['$quantity', '$quantitypreordered'] } },
totalPrice_acquistato: {