- catalogo avanti, parte 1

This commit is contained in:
Surya Paolo
2024-05-04 14:49:02 +02:00
parent e1f2e799d6
commit 07973fbf0a
14 changed files with 639 additions and 171 deletions

View File

@@ -33,6 +33,9 @@ const productSchema = new Schema({
type: Boolean,
default: true,
},
isbn: {
type: String,
},
idProductInfo: { type: Schema.Types.ObjectId, ref: 'ProductInfo' },
idProducer: { type: Schema.Types.ObjectId, ref: 'Producer' },
idStorehouses: [
@@ -146,6 +149,9 @@ const productSchema = new Schema({
note: {
type: String,
},
versione: {
type: Number,
},
producer_name: {
type: String,
},
@@ -346,6 +352,14 @@ module.exports.findAllIdApp = async function (idapp, code, id, all) {
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'authors',
localField: 'productInfo.idAuthors',
foreignField: '_id',
as: 'productInfo.authors'
}
},
{
$lookup: {
from: 'catprods',
@@ -836,8 +850,8 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
ris = await Product.updateOne({ _id: ObjectID(prod._id) }, { $unset: objDelete })
if (ris) {
console.log('ris', ris);
if (ris && ris.nModified > 0) {
console.log('Modificato: ', objtoset.name);
}
// const campodarimuovere = 'producer_name';