- cataloghi...

- fix: condividi su Telegram non funzionava errore sull'immagine
This commit is contained in:
Surya Paolo
2024-11-02 18:06:12 +01:00
parent 3bdab927b6
commit b7ffd751dc
12 changed files with 145 additions and 48 deletions

View File

@@ -64,6 +64,9 @@ const MyBachecaSchema = new Schema({
contact_phone: {
type: String
},
contact_email: {
type: String
},
contact_telegram: {
type: String
},

View File

@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
const tools = require('../tools/general');
const { ObjectID, ObjectId } = require('mongodb');
const { MySchedaSchema, scheletroScheda } = require('../models/myscheda');
const { MySchedaSchema, IDimensioni } = require('../models/myscheda');
mongoose.Promise = global.Promise;
mongoose.level = "F";
@@ -48,6 +48,13 @@ const elemText = new Schema(
}
);
const IElementiPagina = new Schema(
{
pagina: IDimensioni,
riga: IDimensioni,
}
);
const catalogo = new Schema(
{
@@ -57,10 +64,6 @@ const catalogo = new Schema(
Editore: [{ type: String }],
pdf: { type: Boolean },
printable: { type: Boolean },
backgroundimage: { type: String },
backgroundimage_printable: { type: String },
widthpag: { type: Number },
widthpagPrintable: { type: Number },
width: { type: String },
height: { type: String },
@@ -73,15 +76,27 @@ 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 },
backgroundimage: { type: String },
backgroundimage_printable: { type: String },
backgroundSize: { type: String },
backgroundSize_printable: { type: String },
widthpagPrintable: { type: Number },
// -------------------
arrSchede: [
{
scheda: scheletroScheda,
scheda: MySchedaSchema,
order: { type: Number },
numSchede: { type: Number },
/*arrProdToShow: {
type: [[mongoose.Schema.Types.Mixed]], // Definizione tipo
select: false // Imposta il campo come non selezionabile
},*/
}
],
}

View File

@@ -13,24 +13,46 @@ mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const ISize = new Schema({
width: { type: String },
height: { type: String },
});
const IBorders = new Schema({
top: { type: String },
bottom: { type: String },
left: { type: String },
right: { type: String },
})
const IDimensioni = new Schema({
size: ISize,
margini: IBorders,
padding: IBorders,
});
const IElementiScheda = new Schema({
pagina: IDimensioni,
riga: IDimensioni,
scheda_prodotto: IDimensioni,
immagine_prodotto: IDimensioni,
});
const scheletroScheda = {
idapp: {
type: String,
},
name: { type: String },
idapp: { type: String },
isTemplate: { type: Boolean },
widthpag: { type: Number },
width: { type: Number },
height: { type: Number },
widthscheda: { type: String },
name: { type: String },
line_height: { type: Number },
numschede_perRiga: { type: Number },
numschede_perCol: { type: Number },
margine_top: { type: Number },
margine_pagina: { type: String },
margine_riga: { type: String },
text: { type: String },
posiz_text: { type: Number },
line_height: { type: Number },
dimensioni: IElementiScheda,
bgimg: { type: String },
bgimg_printable: { type: String },
bgSize: { type: String },
bgSize_Printable: { type: String },
productTypes: [{ type: Number }],
excludeproductTypes: [{ type: Number }],
@@ -68,4 +90,4 @@ MyScheda.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyScheda, MySchedaSchema, scheletroScheda };
module.exports = { MyScheda, MySchedaSchema, IDimensioni };

View File

@@ -1009,7 +1009,7 @@ sendNotifSchema.statics.createNewNotification = async function (req, res, params
myrecnotif.idrec = rec._id;
try {
if (rec.photos && rec.photos[0]) {
const mydir = server_constants.DIR_UPLOAD + shared_consts.getDirectoryByTable(table, true);
const mydir = tools.getHostByIdApp(myrecnotif.idapp) + server_constants.DIR_UPLOAD + '/' + shared_consts.getDirectoryImgByTable(table, rec.username);
myrecnotif.img = mydir + rec.photos[0].imagefile;
}
} catch (e) {