nuova veste grafica: myskills, mygoods, mybachecas, myhosps,

- cambiato id (da numero a stringa)
This commit is contained in:
Surya Paolo
2023-04-07 02:45:21 +02:00
parent 8a77dabc22
commit 94ef2c4c85
15 changed files with 1582 additions and 972 deletions

View File

@@ -15,7 +15,10 @@ mongoose.plugin(schema => {
const MyGroupSchema = new Schema({
_id: {
type: String,
type: String,
default: function () {
return new ObjectID().toString();
},
},
idapp: {
type: String,
@@ -144,18 +147,8 @@ MyGroupSchema.statics.executeQueryTable = function (idapp, params, user) {
MyGroupSchema.pre('save', async function (next) {
if (this.isNew) {
const myrec = await MyGroup.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;
}
this.date_created = new Date();
if (!this.date_created)
this.date_created = new Date();
}
next();