- corretto problema ROGNOSO : Risolvere la questione "Sessioni multiple", se apro 2 browser l'ultimo va a cancellare il precedente, e mi da errore di email non valida !

Il problema era sulla fetch nel service worker, gestita in quel modo personalizzato, andava in conflitto, non tenendo le chiamate bloccanti, ma uscivano prima che arrivasse la risposta del server.
- Per chi è da tanto che non si collega a RISO, compare "Email non verificata"... (si risolve chiudendo su ESCI e riloggandosi)... però andrebbe sistemata.
(stesso problema di prima).
This commit is contained in:
Surya Paolo
2025-10-26 02:48:07 +02:00
parent 610961d22c
commit 8f54cd2791
23 changed files with 82101 additions and 1848 deletions

View File

@@ -15,7 +15,7 @@ const { MyGroup } = require('./mygroup');
const tableModel = shared_consts.TABLES_MYBACHECAS;
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
mongoose.plugin((schema) => {
schema.options.usePushEach = true;
});
@@ -43,32 +43,37 @@ const MyBachecaSchema = new Schema({
idStatusSkill: [
{
type: Number,
}],
},
],
idContribType: [
{
type: String,
}],
},
],
idCity: [
{
type: Number,
}],
},
],
dateTimeStart: {
type: Date,
},
dateTimeEnd: {
type: Date,
required: false, // non obbligatorio
default: null, // valore predefinito esplicito (opzionale)
},
organisedBy: {
type: String
type: String,
},
contact_phone: {
type: String
type: String,
},
contact_email: {
type: String
type: String,
},
contact_telegram: {
type: String
type: String,
},
address: {
type: String,
@@ -103,7 +108,8 @@ const MyBachecaSchema = new Schema({
description: {
type: String,
},
}],
},
],
note: {
type: String,
default: '',
@@ -121,15 +127,17 @@ const MyBachecaSchema = new Schema({
date_updated: {
type: Date,
},
link_conference: {
type: String,
},
},
...Reaction.getFieldsForReactions(),
...tools.getFieldsForAnnunci()
...tools.getFieldsForAnnunci(),
});
MyBachecaSchema.pre('save', async function (next) {
if (this.isNew) {
if (!this.date_created)
this.date_created = new Date();
if (!this.date_created) this.date_created = new Date();
}
next();
@@ -138,13 +146,9 @@ MyBachecaSchema.pre('save', async function (next) {
MyBachecaSchema.statics.findAllIdApp = async function (idapp) {
const MyBacheca = this;
const query = [
{ $match: { idapp } },
{ $sort: { descr: 1 } },
];
const query = [{ $match: { idapp } }, { $sort: { descr: 1 } }];
return await MyBacheca.aggregate(query);
};
MyBachecaSchema.statics.getFieldsForSearch = function () {
@@ -160,7 +164,6 @@ MyBachecaSchema.statics.getFieldsLastForSearch = function () {
];
};
MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
params.fieldsearch = this.getFieldsForSearch();
params.fieldsearch_last = this.getFieldsLastForSearch();
@@ -184,16 +187,14 @@ MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
const MyBacheca = this;
let myparsid = {
'_id': id,
_id: id,
idapp,
};
let query = [
{
$match:
myparsid,
$match: myparsid,
},
{
$sort: {
@@ -202,28 +203,25 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
},
{
$addFields: {
'myId1': {
'$toObjectId': '$userId',
myId1: {
$toObjectId: '$userId',
},
},
},
{
'$lookup': {
'from': 'users',
'localField': 'myId1',
'foreignField': '_id',
'as': 'user',
$lookup: {
from: 'users',
localField: 'myId1',
foreignField: '_id',
as: 'user',
},
},
{
'$replaceRoot': {
'newRoot': {
'$mergeObjects': [
$replaceRoot: {
newRoot: {
$mergeObjects: [
{
'$arrayElemAt': [
'$user',
0,
],
$arrayElemAt: ['$user', 0],
},
'$$ROOT',
],
@@ -234,22 +232,19 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
$project: shared_consts.getProjectForAll({}, tableModel),
},
{
'$lookup': {
'from': 'skills',
'localField': 'idSkill',
'foreignField': '_id',
'as': 'recSkill',
$lookup: {
from: 'skills',
localField: 'idSkill',
foreignField: '_id',
as: 'recSkill',
},
},
{
'$replaceRoot': {
'newRoot': {
'$mergeObjects': [
$replaceRoot: {
newRoot: {
$mergeObjects: [
{
'$arrayElemAt': [
'$recSkill',
0,
],
$arrayElemAt: ['$recSkill', 0],
},
'$$ROOT',
],
@@ -260,22 +255,19 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
$project: shared_consts.getProjectForAll({}, tableModel),
},
{
'$lookup': {
'from': 'sectors',
'localField': 'idSector',
'foreignField': '_id',
'as': 'sector',
$lookup: {
from: 'sectors',
localField: 'idSector',
foreignField: '_id',
as: 'sector',
},
},
{
'$replaceRoot': {
'newRoot': {
'$mergeObjects': [
$replaceRoot: {
newRoot: {
$mergeObjects: [
{
'$arrayElemAt': [
'$sector',
0,
],
$arrayElemAt: ['$sector', 0],
},
'$$ROOT',
],
@@ -284,10 +276,10 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
},
{
$lookup: {
'from': 'mygroups',
'localField': 'groupname',
'foreignField': 'groupname',
'as': 'mygrp',
from: 'mygroups',
localField: 'groupname',
foreignField: 'groupname',
as: 'mygrp',
},
},
{
@@ -308,14 +300,11 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
},
},*/
{
'$replaceRoot': {
'newRoot': {
'$mergeObjects': [
$replaceRoot: {
newRoot: {
$mergeObjects: [
{
'$arrayElemAt': [
'$MyBacheca',
0,
],
$arrayElemAt: ['$MyBacheca', 0],
},
'$$ROOT',
],
@@ -326,22 +315,19 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
$project: shared_consts.getProjectForAll({}, tableModel),
},
{
'$lookup': {
'from': 'cities',
'localField': 'idCity',
'foreignField': '_id',
'as': 'mycities',
$lookup: {
from: 'cities',
localField: 'idCity',
foreignField: '_id',
as: 'mycities',
},
},
{
'$replaceRoot': {
'newRoot': {
'$mergeObjects': [
$replaceRoot: {
newRoot: {
$mergeObjects: [
{
'$arrayElemAt': [
'$mycities',
0,
],
$arrayElemAt: ['$mycities', 0],
},
'$$ROOT',
],
@@ -370,20 +356,18 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
});
};
MyBachecaSchema.statics.getCompleteRecord = function (idapp, id) {
const MyBacheca = this;
return MyBacheca.getMyRecById(idapp, id);
};
const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema);
MyBacheca.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
.then(() => {})
.catch((err) => {
throw err;
});
module.exports = { MyBacheca };