53 lines
1.0 KiB
JavaScript
53 lines
1.0 KiB
JavaScript
|
|
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,
|
||
|
|
},
|
||
|
|
}, {
|
||
|
|
collection: 't_web_disponibiles', // nome della collezione esatto
|
||
|
|
timestamps: false,
|
||
|
|
});
|
||
|
|
|
||
|
|
module.exports = mongoose.model('TWebDisponibile', TWebDisponibileSchema);
|
||
|
|
|
||
|
|
module.exports.createIndexes()
|
||
|
|
.then(() => { })
|
||
|
|
.catch((err) => { throw err; });
|