new version Visualizzazione Service

This commit is contained in:
Surya Paolo
2023-04-04 15:26:56 +02:00
parent 6d1ad4132f
commit 8a77dabc22
8 changed files with 198 additions and 63 deletions

View File

@@ -15,7 +15,10 @@ mongoose.plugin(schema => {
const MySkillSchema = new Schema({
_id: {
type: Number,
type: String,
default: function () {
return new ObjectID().toString();
},
},
idapp: {
type: String,
@@ -92,17 +95,6 @@ const MySkillSchema = new Schema({
MySkillSchema.pre('save', async function(next) {
if (this.isNew) {
const myrec = await MySkill.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();
}
@@ -153,6 +145,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params, user) {
myskill: 1,
idStatusSkill: 1,
idContribType: 1,
'profile.username_telegram': 1,
idCity: 1,
pub_to_share: 1,
numLevel: 1,
@@ -173,6 +166,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params, user) {
"profile.mygroups": 1,
"profile.mycircuits": 1,
'profile.qualifica': 1,
'profile.resid_province': 1,
reported: 1,
},
},
@@ -186,13 +180,19 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params, user) {
MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
const MySkill = this;
let myparskill = {};
if (tools.isNumber(idSkill)) {
myparskill = {'_id': parseInt(idSkill)};
} else {
myparskill = {'_id': idSkill};
}
const query = [
{
'$match': {
'$and': [
{
'_id': parseInt(idSkill),
},
myparskill,
],
},
},
@@ -266,6 +266,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
"profile.mygroups": 1,
"profile.mycircuits": 1,
'profile.qualifica': 1,
'profile.resid_province': 1,
reported: 1,
},
},
@@ -322,6 +323,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
"profile.mygroups": 1,
"profile.mycircuits": 1,
'profile.qualifica': 1,
'profile.resid_province': 1,
reported: 1,
},
},
@@ -378,6 +380,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
"profile.mygroups": 1,
"profile.mycircuits": 1,
'profile.qualifica': 1,
'profile.resid_province': 1,
reported: 1,
},
},
@@ -436,6 +439,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
"profile.mygroups": 1,
"profile.mycircuits": 1,
'profile.qualifica': 1,
'profile.resid_province': 1,
reported: 1,
},
},
@@ -492,6 +496,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
"profile.mygroups": 1,
"profile.mycircuits": 1,
'profile.qualifica': 1,
'profile.resid_province': 1,
reported: 1,
},
},