- attivita

- gestione degli script sul server
 - creato websocket per interagire con gli script del server.
This commit is contained in:
Surya Paolo
2024-08-29 23:30:58 +02:00
parent d527f49c5e
commit 45f601bd26
25 changed files with 534 additions and 45 deletions

View File

@@ -7,6 +7,7 @@ mongoose.level = 'F';
const tools = require('../tools/general');
const { Reaction } = require('./reaction');
const { MyGroup } = require('./mygroup');
const shared_consts = require('../tools/shared_nodejs');
@@ -84,10 +85,10 @@ const AttivitaSchema = new Schema(
type: Number,
},
nome_attivita: {
descr: {
type: String,
},
descr: {
note: {
type: String,
},
@@ -127,7 +128,8 @@ const AttivitaSchema = new Schema(
//**ADDFIELD_ATTIVITA
},
...Reaction.getFieldsForReactions()
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
}, { strict: false });
AttivitaSchema.index({ 'idapp': 1 });
@@ -362,7 +364,6 @@ AttivitaSchema.statics.getProject = function (proj_add2) {
date_created: 1,
date_updated: 1,
tipodiAttivita: 1,
nome_attivita: 1,
coordinate_gps: 1,
email: 1,
telegram_username: 1,

View File

@@ -10,6 +10,7 @@ const { ObjectID } = require('mongodb');
const shared_consts = require('../tools/shared_nodejs');
const { Reaction } = require('./reaction');
const { MyGroup } = require('./mygroup');
const tableModel = shared_consts.TABLES_MYBACHECAS;
@@ -118,7 +119,8 @@ const MyBachecaSchema = new Schema({
type: Date,
},
},
...Reaction.getFieldsForReactions()
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
});
MyBachecaSchema.pre('save', async function (next) {

View File

@@ -7,6 +7,7 @@ mongoose.level = 'F';
const tools = require('../tools/general');
const { Reaction } = require('./reaction');
const { MyGroup } = require('./mygroup');
const shared_consts = require('../tools/shared_nodejs');
@@ -90,7 +91,8 @@ const MyGoodSchema = new Schema({
type: Date,
},
},
...Reaction.getFieldsForReactions()
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
});
MyGoodSchema.pre('save', async function (next) {

View File

@@ -125,6 +125,12 @@ const MyGroupSchema = new Schema({
lastdate_reqRisGroup: {
type: Date,
},
idMyGroup: {
type: String,
},
// **ADDFIELD_MYGROUPS
});
MyGroupSchema.statics.getFieldsForSearch = function () {
@@ -236,7 +242,7 @@ MyGroupSchema.statics.getListAdminsByGroupName = async function (idapp, groupnam
MyGroupSchema.statics.getWhatToShow = function (idapp, username) {
// FOR ME, PERMIT ALL
return {
let whatToShow = {
groupname: 1,
title: 1,
descr: 1,
@@ -260,10 +266,14 @@ MyGroupSchema.statics.getWhatToShow = function (idapp, username) {
lastdate_reqRisGroup: 1,
};
whatToShow = { ...whatToShow, ...shared_consts.ANNUNCI_FIELDS };
return whatToShow;
};
MyGroupSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
return {
let whatToShow = {
groupname: 1,
title: 1,
descr: 1,
@@ -277,6 +287,11 @@ MyGroupSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
mycircuits: 1,
lastdate_reqRisGroup: 1,
};
whatToShow = { ...whatToShow, ...shared_consts.ANNUNCI_FIELDS };
return whatToShow;
};
MyGroupSchema.statics.getArrUsernameFromFieldByGroupname = async function (
@@ -648,7 +663,16 @@ MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
};
MyGroupSchema.statics.getFieldsForAnnunci = function () {
let annunciFields = {
idMyGroup: {
type: String,
},
// **ADDFIELD_MYGROUPS
};
return annunciFields;
};
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);

View File

@@ -7,6 +7,7 @@ mongoose.level = 'F';
const tools = require('../tools/general');
const { Reaction } = require('./reaction');
const { MyGroup } = require('./mygroup');
const shared_consts = require('../tools/shared_nodejs');
const { ObjectID } = require('mongodb');
@@ -94,7 +95,8 @@ const MyHospSchema = new Schema({
type: Date,
},
},
...Reaction.getFieldsForReactions()
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
});
MyHospSchema.pre('save', async function (next) {

View File

@@ -7,6 +7,7 @@ mongoose.level = 'F';
const tools = require('../tools/general');
const { Reaction } = require('./reaction');
const { MyGroup } = require('./mygroup');
const shared_consts = require('../tools/shared_nodejs');
@@ -97,7 +98,8 @@ const MySkillSchema = new Schema(
type: Date,
},
},
...Reaction.getFieldsForReactions()
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
}, { strict: false });
MySkillSchema.index({ 'idapp': 1 });

View File

@@ -4561,7 +4561,7 @@ UserSchema.statics.calculateStat = async function (idapp, username) {
const { MySkill } = require('../models/myskill');
const { MyGood } = require('../models/mygood');
const { MyBacheca } = require('../models/mybacheca');
const { MyGroup } = require('../models/mygroup');
// const { MyGroup } = require('../models/mygroup');
const globalTables = require('../tools/globalTables');
const numUsersReg = await User.countDocuments(