+ Registered Users
+ UsersList Online
This commit is contained in:
@@ -164,6 +164,7 @@ ExtraListSchema.statics.getUsersList = function (idapp) {
|
|||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
|||||||
|
|
||||||
const tools = require('../tools/general');
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
const {ObjectID} = require('mongodb');
|
const { ObjectID } = require('mongodb');
|
||||||
|
|
||||||
// Resolving error Unknown modifier: $pushAll
|
// Resolving error Unknown modifier: $pushAll
|
||||||
mongoose.plugin(schema => {
|
mongoose.plugin(schema => {
|
||||||
@@ -21,7 +21,7 @@ const MyBachecaSchema = new Schema({
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
userId: {type: Schema.Types.ObjectId, ref: 'User'},
|
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||||
idSector: {
|
idSector: {
|
||||||
type: Number,
|
type: Number,
|
||||||
},
|
},
|
||||||
@@ -86,9 +86,9 @@ const MyBachecaSchema = new Schema({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
MyBachecaSchema.pre('save', async function(next) {
|
MyBachecaSchema.pre('save', async function (next) {
|
||||||
if (this.isNew) {
|
if (this.isNew) {
|
||||||
const myrec = await MyBacheca.findOne().limit(1).sort({_id: -1});
|
const myrec = await MyBacheca.findOne().limit(1).sort({ _id: -1 });
|
||||||
if (!!myrec) {
|
if (!!myrec) {
|
||||||
if (myrec._doc._id === 0)
|
if (myrec._doc._id === 0)
|
||||||
this._id = 1;
|
this._id = 1;
|
||||||
@@ -105,12 +105,12 @@ MyBachecaSchema.pre('save', async function(next) {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
MyBachecaSchema.statics.findAllIdApp = async function(idapp) {
|
MyBachecaSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const MyBacheca = this;
|
const MyBacheca = this;
|
||||||
|
|
||||||
const query = [
|
const query = [
|
||||||
{$match: {idapp}},
|
{ $match: { idapp } },
|
||||||
{$sort: {descr: 1}},
|
{ $sort: { descr: 1 } },
|
||||||
];
|
];
|
||||||
|
|
||||||
return await MyBacheca.aggregate(query).then((arrrec) => {
|
return await MyBacheca.aggregate(query).then((arrrec) => {
|
||||||
@@ -119,21 +119,21 @@ MyBachecaSchema.statics.findAllIdApp = async function(idapp) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MyBachecaSchema.statics.getFieldsForSearch = function() {
|
MyBachecaSchema.statics.getFieldsForSearch = function () {
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
|
|
||||||
MyBachecaSchema.statics.getFieldsLastForSearch = function() {
|
MyBachecaSchema.statics.getFieldsLastForSearch = function () {
|
||||||
return [
|
return [
|
||||||
{field: 'note', type: tools.FieldType.string},
|
{ field: 'note', type: tools.FieldType.string },
|
||||||
{field: 'descr', type: tools.FieldType.string},
|
{ field: 'descr', type: tools.FieldType.string },
|
||||||
{field: 'recSkill.descr', type: tools.FieldType.string},
|
{ field: 'recSkill.descr', type: tools.FieldType.string },
|
||||||
{field: 'MyBacheca.descr', type: tools.FieldType.string},
|
{ field: 'MyBacheca.descr', type: tools.FieldType.string },
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MyBachecaSchema.statics.executeQueryTable = function(idapp, params, user) {
|
MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
params.fieldsearch_last = this.getFieldsLastForSearch();
|
params.fieldsearch_last = this.getFieldsLastForSearch();
|
||||||
|
|
||||||
@@ -167,6 +167,7 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params, user) {
|
|||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
"profile.mygroups": 1,
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
@@ -177,12 +178,12 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params, user) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
params = {...params, ...otherparams};
|
params = { ...params, ...otherparams };
|
||||||
|
|
||||||
return tools.executeQueryTable(this, idapp, params, user);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||||
const MyBacheca = this;
|
const MyBacheca = this;
|
||||||
|
|
||||||
const query = [
|
const query = [
|
||||||
@@ -509,7 +510,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
MyBachecaSchema.statics.getCompleteRecord = function(idapp, id) {
|
MyBachecaSchema.statics.getCompleteRecord = function (idapp, id) {
|
||||||
const MyBacheca = this;
|
const MyBacheca = this;
|
||||||
|
|
||||||
return MyBacheca.getMyRecById(idapp, id);
|
return MyBacheca.getMyRecById(idapp, id);
|
||||||
@@ -519,4 +520,4 @@ MyBachecaSchema.statics.getCompleteRecord = function(idapp, id) {
|
|||||||
|
|
||||||
const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema);
|
const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema);
|
||||||
|
|
||||||
module.exports = {MyBacheca};
|
module.exports = { MyBacheca };
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ MyGoodSchema.statics.executeQueryTable = function(idapp, params, user) {
|
|||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
"profile.mygroups": 1,
|
"profile.mygroups": 1,
|
||||||
"profile.mycircuits": 1,
|
"profile.mycircuits": 1,
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ MyHospSchema.statics.executeQueryTable = function(idapp, params, user) {
|
|||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
"profile.mygroups": 1,
|
"profile.mygroups": 1,
|
||||||
"profile.mycircuits": 1,
|
"profile.mycircuits": 1,
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params, user) {
|
|||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
"profile.mygroups": 1,
|
"profile.mygroups": 1,
|
||||||
"profile.mycircuits": 1,
|
"profile.mycircuits": 1,
|
||||||
|
|||||||
@@ -731,6 +731,7 @@ sendNotifSchema.statics.sendToTheDestinations = async function(myrecnotifpass, r
|
|||||||
}, {
|
}, {
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
lang: 1,
|
lang: 1,
|
||||||
username: 1,
|
username: 1,
|
||||||
'profile.notifs': 1,
|
'profile.notifs': 1,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@ router.post('/load', async (req, res) => {
|
|||||||
|
|
||||||
let datastat = {
|
let datastat = {
|
||||||
num_reg: await User.getUsersRegistered(idapp),
|
num_reg: await User.getUsersRegistered(idapp),
|
||||||
|
num_reg_today: await User.getUsersRegisteredToday(idapp),
|
||||||
online_today: await User.getUsersOnLineToday(idapp),
|
online_today: await User.getUsersOnLineToday(idapp),
|
||||||
// num_passeggeri: await 0,
|
// num_passeggeri: await 0,
|
||||||
// num_imbarcati: 0,
|
// num_imbarcati: 0,
|
||||||
@@ -46,6 +47,7 @@ router.post('/load', async (req, res) => {
|
|||||||
// imbarcati_weekly: 0,
|
// imbarcati_weekly: 0,
|
||||||
reg_weekly: await User.calcRegWeekly(idapp),
|
reg_weekly: await User.calcRegWeekly(idapp),
|
||||||
lastsreg: await User.getLastUsers(idapp),
|
lastsreg: await User.getLastUsers(idapp),
|
||||||
|
lastsonline: await User.getLastOnlineUsers(idapp),
|
||||||
checkuser: await User.checkUser(idapp, username),
|
checkuser: await User.checkUser(idapp, username),
|
||||||
// navi_partite: await Nave.getNaviPartite(idapp),
|
// navi_partite: await Nave.getNaviPartite(idapp),
|
||||||
// navi_in_partenza: await Nave.getNaviInPartenza(idapp),
|
// navi_in_partenza: await Nave.getNaviInPartenza(idapp),
|
||||||
|
|||||||
Reference in New Issue
Block a user