Table MySkills

This commit is contained in:
Paolo Arena
2021-10-08 00:38:35 +02:00
parent 87739a5847
commit 300ab15ca7
10 changed files with 1421 additions and 903 deletions

View File

@@ -14,15 +14,46 @@ mongoose.plugin(schema => {
});
const SectorSchema = new Schema({
_id: {
type: Number,
},
descr: {
type: String,
},
idSector: {
type: Number
},
icon: {
type: String,
},
img: {
type: String,
},
color: {
type: String,
},
theme: {
type: String,
},
main: {
type: Boolean,
}
});
SectorSchema.pre('save', async function (next) {
if (this.isNew) {
const myrec = await Sector.findOne().limit(1).sort({_id:-1});
if (!!myrec) {
if (myrec._doc._id === 0)
this._id = 1;
else
this._id = myrec._doc._id + 1;
} else {
this._id = 1;
}
}
next();
});
SectorSchema.statics.findAllIdApp = function (idapp) {