++GasOrdini
This commit is contained in:
@@ -28,6 +28,7 @@ const orderSchema = new Schema({
|
||||
idStorehouse: { type: Schema.Types.ObjectId, ref: 'StoreHouse' },
|
||||
idScontisticas: [{ type: Schema.Types.ObjectId, ref: 'Scontistica' }],
|
||||
idProvider: { type: Schema.Types.ObjectId, ref: 'Provider' },
|
||||
idGasordine: { type: Schema.Types.ObjectId, ref: 'Gasordine' },
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
@@ -169,6 +170,14 @@ module.exports.findAllIdApp = async function (idapp) {
|
||||
as: 'provider'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'gasordines',
|
||||
localField: 'idGasordine',
|
||||
foreignField: '_id',
|
||||
as: 'gasordine'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'scontisticas',
|
||||
@@ -194,6 +203,12 @@ module.exports.findAllIdApp = async function (idapp) {
|
||||
path: '$provider',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$gasordine',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
}
|
||||
|
||||
];
|
||||
@@ -346,6 +361,14 @@ module.exports.getTotalOrderById = async function (id) {
|
||||
as: 'provider'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'gasordines',
|
||||
localField: 'idGasordine',
|
||||
foreignField: '_id',
|
||||
as: 'gasordine'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'scontisticas',
|
||||
@@ -378,6 +401,12 @@ module.exports.getTotalOrderById = async function (id) {
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$gasordine',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'orders',
|
||||
|
||||
Reference in New Issue
Block a user