Aggiunto filtro numMaxPeopleHosp
This commit is contained in:
@@ -22,6 +22,9 @@ const MyHospSchema = new Schema({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
userId: {type: Schema.Types.ObjectId, ref: 'User'},
|
userId: {type: Schema.Types.ObjectId, ref: 'User'},
|
||||||
|
visibile: {
|
||||||
|
type: Boolean
|
||||||
|
},
|
||||||
typeHosp: { // scambio casa / ospitalità
|
typeHosp: { // scambio casa / ospitalità
|
||||||
type: Number,
|
type: Number,
|
||||||
},
|
},
|
||||||
@@ -143,6 +146,7 @@ MyHospSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
lk_as: 'user',
|
lk_as: 'user',
|
||||||
af_objId_tab: 'myId',
|
af_objId_tab: 'myId',
|
||||||
lk_proj: {
|
lk_proj: {
|
||||||
|
visibile: 1,
|
||||||
typeHosp: 1,
|
typeHosp: 1,
|
||||||
numMaxPeopleHosp: 1,
|
numMaxPeopleHosp: 1,
|
||||||
accomodation: 1,
|
accomodation: 1,
|
||||||
@@ -226,6 +230,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': {
|
'$project': {
|
||||||
|
visibile: 1,
|
||||||
typeHosp: 1,
|
typeHosp: 1,
|
||||||
numMaxPeopleHosp: 1,
|
numMaxPeopleHosp: 1,
|
||||||
accomodation: 1,
|
accomodation: 1,
|
||||||
@@ -274,6 +279,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': {
|
'$project': {
|
||||||
|
visibile: 1,
|
||||||
typeHosp: 1,
|
typeHosp: 1,
|
||||||
numMaxPeopleHosp: 1,
|
numMaxPeopleHosp: 1,
|
||||||
accomodation: 1,
|
accomodation: 1,
|
||||||
@@ -322,6 +328,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': {
|
'$project': {
|
||||||
|
visibile: 1,
|
||||||
typeHosp: 1,
|
typeHosp: 1,
|
||||||
numMaxPeopleHosp: 1,
|
numMaxPeopleHosp: 1,
|
||||||
accomodation: 1,
|
accomodation: 1,
|
||||||
@@ -370,6 +377,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': {
|
'$project': {
|
||||||
|
visibile: 1,
|
||||||
typeHosp: 1,
|
typeHosp: 1,
|
||||||
numMaxPeopleHosp: 1,
|
numMaxPeopleHosp: 1,
|
||||||
accomodation: 1,
|
accomodation: 1,
|
||||||
@@ -418,6 +426,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': {
|
'$project': {
|
||||||
|
visibile: 1,
|
||||||
typeHosp: 1,
|
typeHosp: 1,
|
||||||
numMaxPeopleHosp: 1,
|
numMaxPeopleHosp: 1,
|
||||||
accomodation: 1,
|
accomodation: 1,
|
||||||
|
|||||||
@@ -2822,13 +2822,6 @@ UserSchema.statics.calculateStat = async function(idapp, username) {
|
|||||||
{deleted: {$exists: true, $eq: false}}],
|
{deleted: {$exists: true, $eq: false}}],
|
||||||
});
|
});
|
||||||
|
|
||||||
const numMySkills = await MySkill.countDocuments({idapp});
|
|
||||||
const numMyGoods = await MyGood.countDocuments({idapp});
|
|
||||||
|
|
||||||
const numMyBachecas = await MyBacheca.countDocuments({idapp});
|
|
||||||
|
|
||||||
const numGroups = await MyGroup.countDocuments({idapp});
|
|
||||||
|
|
||||||
let numByTab = {};
|
let numByTab = {};
|
||||||
|
|
||||||
const globalTables = require('../tools/globalTables');
|
const globalTables = require('../tools/globalTables');
|
||||||
|
|||||||
@@ -1537,6 +1537,18 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.filter_gte) {
|
||||||
|
for (let ind = 0; ind < params.filter_gte.length; ind++) {
|
||||||
|
for (const [key, value] of Object.entries(params.filter_gte[ind])) {
|
||||||
|
if (value > 0) {
|
||||||
|
let condition = {}
|
||||||
|
condition[key] = {$gte: value};
|
||||||
|
filtriadded.push(condition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.filtersearch) {
|
if (params.filtersearch) {
|
||||||
filtriadded.push(...params.filtersearch);
|
filtriadded.push(...params.filtersearch);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user