new version Visualizzazione Service
This commit is contained in:
@@ -15,7 +15,10 @@ mongoose.plugin(schema => {
|
||||
|
||||
const MyBachecaSchema = new Schema({
|
||||
_id: {
|
||||
type: Number,
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
type: String,
|
||||
@@ -88,17 +91,6 @@ const MyBachecaSchema = new Schema({
|
||||
|
||||
MyBachecaSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
const myrec = await MyBacheca.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();
|
||||
}
|
||||
|
||||
@@ -171,6 +163,8 @@ MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
'profile.img': 1,
|
||||
"profile.mygroups": 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.resid_province': 1,
|
||||
'profile.username_telegram': 1,
|
||||
reported: 1,
|
||||
date_report: 1,
|
||||
username_who_report: 1,
|
||||
@@ -186,13 +180,21 @@ MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
const MyBacheca = this;
|
||||
|
||||
let myparsid = {
|
||||
$or: [
|
||||
{
|
||||
'_id': parseInt(idGood)
|
||||
},
|
||||
{
|
||||
'_id': idGood,
|
||||
}]
|
||||
};
|
||||
|
||||
const query = [
|
||||
{
|
||||
'$match': {
|
||||
'$and': [
|
||||
{
|
||||
'_id': parseInt(id),
|
||||
},
|
||||
myparsid,
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -268,6 +270,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.resid_province': 1,
|
||||
reported: 1,
|
||||
},
|
||||
},
|
||||
@@ -326,6 +329,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.resid_province': 1,
|
||||
reported: 1,
|
||||
},
|
||||
},
|
||||
@@ -384,6 +388,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.resid_province': 1,
|
||||
reported: 1,
|
||||
},
|
||||
},
|
||||
@@ -442,6 +447,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.resid_province': 1,
|
||||
reported: 1,
|
||||
},
|
||||
},
|
||||
@@ -500,6 +506,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
"profile.mygroups": 1,
|
||||
"profile.mycircuits": 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.resid_province': 1,
|
||||
reported: 1,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user