- Cataloghi: pagine, schede, formato

This commit is contained in:
Surya Paolo
2024-11-19 19:18:54 +01:00
parent 73cf977754
commit b1b952d120
16 changed files with 74 additions and 54 deletions

View File

@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
const tools = require('../tools/general');
const { ObjectID, ObjectId } = require('mongodb');
const { MySchedaSchema, IDimensioni } = require('../models/myscheda');
const { MySchedaSchema, IDimensioni, IImg } = require('../models/myscheda');
mongoose.Promise = global.Promise;
mongoose.level = "F";
@@ -15,6 +15,10 @@ mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const IElementiPagina = new Schema({
pagina: IDimensioni,
});
const myCard = new Schema(
{
imagefile: String,
@@ -48,13 +52,6 @@ const elemText = new Schema(
}
);
const IElementiPagina = new Schema(
{
pagina: IDimensioni,
riga: IDimensioni,
}
);
const catalogo = new Schema(
{
@@ -63,9 +60,8 @@ const catalogo = new Schema(
excludeproductTypes: [{ type: Number }],
Editore: [{ type: String }],
pdf: { type: Boolean },
pdf_filename: { type: String },
printable: { type: Boolean },
width: { type: String },
height: { type: String },
first_page_img: { type: String },
first_page_html: { type: String },
@@ -76,17 +72,10 @@ const catalogo = new Schema(
last_page_height: { type: Number },
last_page_width: { type: Number },
margine_pagina: { type: String },
margine_riga: { type: String },
margine_paginaPrintable: { type: String },
margine_rigaPrintable: { type: String },
imgsfondo_def: IImg,
dimensioni_def: IElementiPagina,
backgroundimage: { type: String },
backgroundimage_printable: { type: String },
backgroundSize: { type: String },
backgroundSize_printable: { type: String },
widthpagPrintable: { type: Number },
// -------------------
arrSchede: [
{

View File

@@ -16,6 +16,11 @@ mongoose.plugin(schema => {
const ISize = new Schema({
width: { type: String },
height: { type: String },
fit: { type: String },
});
const IFont = new Schema({
name: { type: String },
size: { type: String },
});
const IBorders = new Schema({
@@ -24,12 +29,33 @@ const IBorders = new Schema({
left: { type: String },
right: { type: String },
})
const IImg = new Schema({
imagefile: { type: String },
fit: { type: String },
})
const IDimensioni = new Schema({
size: ISize,
margini: IBorders,
padding: IBorders,
imgsfondo: IImg,
});
const IBarCode = new Schema(
{
show: Boolean,
format: String,
size: ISize,
font: IFont,
}
);
const IText = new Schema(
{
contenuto: String,
maxlength: Number,
}
);
const IElementiScheda = new Schema({
pagina: IDimensioni,
riga: IDimensioni,
@@ -44,16 +70,13 @@ const scheletroScheda = {
line_height: { type: Number },
numschede_perRiga: { type: Number },
numschede_perCol: { type: Number },
text: { type: String },
testo_right: IText,
testo_bottom: IText,
posiz_text: { type: Number },
barcode: IBarCode,
dimensioni: IElementiScheda,
bgimg: { type: String },
bgimg_printable: { type: String },
bgSize: { type: String },
bgSize_Printable: { type: String },
productTypes: [{ type: Number }],
excludeproductTypes: [{ type: Number }],
editore: [{ type: String }],
@@ -90,4 +113,4 @@ MyScheda.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyScheda, MySchedaSchema, IDimensioni };
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg };

View File

@@ -76,9 +76,12 @@ const productSchema = new Schema({
quantita: { // in magazzino
type: Number,
},
numpages: {
pagine: {
type: Number,
},
misure: {
type: String,
},
formato: {
type: String,
},

View File

@@ -481,15 +481,6 @@ router.post('/import', authenticate, async (req, res) => {
productInfo.name = productInfo.name.replace(/ - Usato$| - Nuovo$| - Epub$| - Ebook$| - Mobi$| - DVD$| - Streaming$| - Download$/, "");
if (product.Pagine) {
try {
productInfo.numpages = 0;
productInfo.numpages = parseInt(product.Pagine);
} catch (e) {
console.error(e);
}
}
let reccateg = null;
if (product.categories) {
arrcat = product.categories.trim().split(',');
@@ -703,12 +694,15 @@ router.post('/import', authenticate, async (req, res) => {
variazione.active = true; // ++ ??
variazione.versione = versione;
variazione.versione = versione;
variazione.status = product.Stato ? product.Stato : null;
variazione.price = product.price ? parseFloat(tools.convertPriceEurToValue(product.price)) : null;
variazione.sale_price = product.sale_price ? parseFloat(tools.convertPriceEurToValue(product.sale_price)) : null;
variazione.formato = product.formato ? product.formato : '';
variazione.tipologia = product.Tipologia ? product.Tipologia : '';
variazione.edizione = product.Edizione ? product.Edizione : '';
variazione.pagine = product.Pagine ? parseInt(product.Pagine) : '';
variazione.misure = product.misure ? product.misure : '';
variazione.eta = product.eta ? product.eta : '';
variazione.addtocart_link = product.addtocart_link ? product.addtocart_link : '';

View File

@@ -164,7 +164,7 @@ router.post('/', async (req, res) => {
if (lastrec.ipaddr === user.ipaddr) {
// Se l'ha fatto troppo ravvicinato
if (lastrec.date_reg) {
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 5);
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 3);
if (ris) {
const msg = user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' +
user.surname;

View File

@@ -1075,7 +1075,8 @@ module.exports = {
{ name: 'author', type: '' },
{ name: 'collezione', type: '' },
{ name: 'publisher', type: '' },
{ name: 'numpages', type: '' },
{ name: 'pagine', type: '' },
{ name: 'misure', type: '' },
{ name: 'note', type: '' },
],

View File

@@ -1 +1 @@
1.1.11
1.1.12