Mostrare il Bene, Servizio, solo ai Propri Gruppi.

Nella pagina profilo, i "Gruppi" personali non si vedevano !
This commit is contained in:
Paolo Arena
2022-06-16 20:34:42 +02:00
parent d8aa8e546e
commit c3b0a1f417
17 changed files with 170 additions and 52 deletions

View File

@@ -14,7 +14,7 @@ mongoose.plugin(schema => {
});
const CircuitSchema = new Schema({
_id: {
Num: {
type: Number,
unique: true,
},
@@ -116,15 +116,15 @@ CircuitSchema.statics.findAllIdApp = async function(idapp) {
CircuitSchema.pre('save', async function(next) {
if (this.isNew) {
const myrec = await Circuit.findOne().limit(1).sort({_id: -1});
const myrec = await Circuit.findOne().limit(1).sort({Num: -1});
if (!!myrec) {
if (myrec._doc._id === 0)
this._id = 1;
if (myrec._doc.Num === 0)
this.Num = 1;
else
this._id = myrec._doc._id + 1;
this.Num = myrec._doc.Num + 1;
} else {
this._id = 1;
this.Num = 1;
}
}