- estrazione dei dati del libro sul sito di Amazon.
- possibilità di visualizzare i dati estratti e di aggiornare i dati, sia solo se vuoti, che sovrascrivere tutti i dati.
This commit is contained in:
@@ -238,6 +238,12 @@ const productSchema = new Schema({
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
scraped: {
|
||||
type: Boolean,
|
||||
},
|
||||
scraped_date: {
|
||||
type: Date,
|
||||
},
|
||||
validaprod: {
|
||||
esito: {
|
||||
type: Number,
|
||||
@@ -422,6 +428,9 @@ module.exports.executeQueryPickup = async function (idapp, params) {
|
||||
return [...risexact, ...ris];
|
||||
};
|
||||
|
||||
module.exports.getProductByIsbn = function (idapp, isbn) {
|
||||
return Product.findAllIdApp(idapp, null, null, null, isbn);
|
||||
};
|
||||
module.exports.getProductByCode = function (idapp, code) {
|
||||
return Product.findAllIdApp(idapp, code);
|
||||
};
|
||||
@@ -454,7 +463,7 @@ module.exports.isLowQuantityInStockById = async function (id) {
|
||||
return false;
|
||||
};
|
||||
|
||||
module.exports.findAllIdApp = async function (idapp, code, id, all) {
|
||||
module.exports.findAllIdApp = async function (idapp, code, id, all, isbn) {
|
||||
let myfind = {};
|
||||
let myqueryadd = {};
|
||||
let query = [];
|
||||
@@ -478,6 +487,9 @@ module.exports.findAllIdApp = async function (idapp, code, id, all) {
|
||||
if (code) {
|
||||
myfind = { ...myfind, code };
|
||||
}
|
||||
if (isbn) {
|
||||
myfind = { ...myfind, sbn };
|
||||
}
|
||||
if (id) {
|
||||
myqueryadd = {
|
||||
$addFields: {
|
||||
|
||||
Reference in New Issue
Block a user