- 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:
Surya Paolo
2025-05-16 18:52:21 +02:00
parent 7e50299854
commit a374a7d7bc
8 changed files with 458 additions and 79 deletions

View File

@@ -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: {