2025-04-22 18:30:48 +02:00
|
|
|
const mongoose = require('mongoose');
|
|
|
|
|
|
|
|
|
|
const TWebDisponibileSchema = new mongoose.Schema({
|
|
|
|
|
Progressivo: {
|
|
|
|
|
type: mongoose.Schema.Types.Long || Number, // Usa 'mongoose-long' se vuoi long int
|
|
|
|
|
required: true,
|
|
|
|
|
unique: true,
|
|
|
|
|
},
|
|
|
|
|
Codice: {
|
|
|
|
|
type: String,
|
|
|
|
|
maxlength: 50,
|
|
|
|
|
required: true,
|
|
|
|
|
index: true, // usato nei lookup e nei match
|
|
|
|
|
},
|
|
|
|
|
QtaDisponibile: {
|
|
|
|
|
type: mongoose.Decimal128,
|
|
|
|
|
default: 0,
|
|
|
|
|
},
|
|
|
|
|
Giac: {
|
|
|
|
|
type: mongoose.Decimal128,
|
|
|
|
|
default: 0,
|
|
|
|
|
},
|
|
|
|
|
DataOra: {
|
|
|
|
|
type: Date,
|
|
|
|
|
default: Date.now,
|
|
|
|
|
index: true, // per ordinamento
|
|
|
|
|
},
|
|
|
|
|
Enabled: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
DataOraSito: {
|
|
|
|
|
type: Date,
|
|
|
|
|
},
|
|
|
|
|
Ean13: {
|
|
|
|
|
type: String,
|
|
|
|
|
maxlength: 20,
|
|
|
|
|
},
|
|
|
|
|
QtaDisponibileOld: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 0,
|
|
|
|
|
},
|
|
|
|
|
}, {
|
2025-04-29 02:30:19 +02:00
|
|
|
collection: 't_web_disponibiles',
|
2025-04-22 18:30:48 +02:00
|
|
|
timestamps: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = mongoose.model('TWebDisponibile', TWebDisponibileSchema);
|
|
|
|
|
|
|
|
|
|
module.exports.createIndexes()
|
|
|
|
|
.then(() => { })
|
|
|
|
|
.catch((err) => { throw err; });
|