diff --git a/src/server/locales/it.json b/src/server/locales/it.json index 324411a..71fd2e7 100644 --- a/src/server/locales/it.json +++ b/src/server/locales/it.json @@ -126,5 +126,6 @@ "๐Ÿšซ Hai rifiutato l'accesso alla App di RISO da parte di %s!": "๐Ÿšซ Hai rifiutato l'accesso alla App di RISO da parte di %s!", "๐Ÿšซ Ti รจ stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !
Contatta l'Assistenza Tecnica.": "๐Ÿšซ Ti รจ stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !
Contatta l'Assistenza Tecnica.", "๐Ÿšซ %s ha rifiutato l'accesso alla App a %s !": "๐Ÿšซ %s ha rifiutato l'accesso alla App a %s !", - "โœ… Hai Ammesso l'accesso alla App a %s !": "โœ… Hai Ammesso l'accesso alla App a %s !" -} + "โœ… Hai Ammesso l'accesso alla App a %s !": "โœ… Hai Ammesso l'accesso alla App a %s !", + "Good: %": "Good: %" +} \ No newline at end of file diff --git a/src/server/models/attivita.js b/src/server/models/attivita.js index 2212406..66d1854 100755 --- a/src/server/models/attivita.js +++ b/src/server/models/attivita.js @@ -13,6 +13,8 @@ const shared_consts = require('../tools/shared_nodejs'); const { ObjectId } = require('mongodb'); +const tableModel = shared_consts.TABLES_ATTIVITAS; + // Resolving error Unknown modifier: $pushAll mongoose.plugin(schema => { schema.options.usePushEach = true; @@ -182,7 +184,7 @@ AttivitaSchema.statics.executeQueryTable = function (idapp, params, user) { lk_FF: '_id', lk_as: 'user', af_objId_tab: 'myId', - lk_proj: this.getProject(), + lk_proj: shared_consts.getProjectForAll({}, tableModel), }, }; @@ -236,7 +238,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -262,7 +264,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -288,7 +290,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$replaceRoot': { @@ -306,7 +308,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -339,7 +341,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) { query = [...query, ...objadd.query]; const toadd = { - $project: this.getProject(objadd.proj), + $project: shared_consts.getProjectForAll(objadd.proj, tableModel), }; query = [...query, { ...toadd }]; diff --git a/src/server/models/mybacheca.js b/src/server/models/mybacheca.js index 4bf85f6..eafaf0b 100755 --- a/src/server/models/mybacheca.js +++ b/src/server/models/mybacheca.js @@ -233,7 +233,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) { }, }, { - '$project': shared_consts.getProjectForAll({}, tableModel), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -259,7 +259,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) { }, }, { - '$project': shared_consts.getProjectForAll({}, tableModel), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -299,7 +299,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) { }, }, { - '$project': shared_consts.getProjectForAll({}, tableModel), + $project: shared_consts.getProjectForAll({}, tableModel), }, /*{ '$lookup': { @@ -325,7 +325,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) { }, }, { - '$project': shared_consts.getProjectForAll({}, tableModel), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { diff --git a/src/server/models/mygood.js b/src/server/models/mygood.js index 1499e54..3a3d2ef 100755 --- a/src/server/models/mygood.js +++ b/src/server/models/mygood.js @@ -13,6 +13,8 @@ const shared_consts = require('../tools/shared_nodejs'); const { ObjectId } = require('mongodb'); +const tableModel = shared_consts.TABLES_MYGOODS; + // Resolving error Unknown modifier: $pushAll mongoose.plugin(schema => { schema.options.usePushEach = true; @@ -28,6 +30,7 @@ const MyGoodSchema = new Schema({ required: true, }, userId: { type: Schema.Types.ObjectId, ref: 'User' }, + groupname: { type: String }, idSectorGood: { type: Number, }, @@ -143,7 +146,7 @@ MyGoodSchema.statics.executeQueryTable = function (idapp, params, user) { lk_FF: '_id', lk_as: 'user', af_objId_tab: 'myId', - lk_proj: this.getProject(), + lk_proj: shared_consts.getProjectForAll({}, tableModel), }, }; @@ -201,7 +204,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -227,7 +230,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -254,7 +257,21 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) { }, }, { - $project: this.getProject(), + $lookup: { + 'from': 'mygroups', + 'localField': 'groupname', + 'foreignField': 'groupname', + 'as': 'mygrp', + }, + }, + { + $unwind: { + path: '$mygrp', + preserveNullAndEmptyArrays: true, + }, + }, + { + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -280,7 +297,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -313,7 +330,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) { query = [...query, ...objadd.query]; const toadd = { - $project: this.getProject(objadd.proj), + $project: shared_consts.getProjectForAll(objadd.proj, tableModel), }; query = [...query, { ...toadd }]; diff --git a/src/server/models/myhosp.js b/src/server/models/myhosp.js index 4a018bf..7fd4b24 100755 --- a/src/server/models/myhosp.js +++ b/src/server/models/myhosp.js @@ -12,6 +12,8 @@ const { MyGroup } = require('./mygroup'); const shared_consts = require('../tools/shared_nodejs'); const { ObjectId } = require('mongodb'); +const tableModel = shared_consts.TABLES_MYHOSPS; + // Resolving error Unknown modifier: $pushAll mongoose.plugin(schema => { schema.options.usePushEach = true; @@ -27,6 +29,7 @@ const MyHospSchema = new Schema({ required: true, }, userId: { type: Schema.Types.ObjectId, ref: 'User' }, + groupname: { type: String }, visibile: { type: Boolean }, @@ -147,7 +150,7 @@ MyHospSchema.statics.executeQueryTable = function (idapp, params, user) { lk_FF: '_id', lk_as: 'user', af_objId_tab: 'myId', - lk_proj: this.getProject(), + lk_proj: shared_consts.getProjectForAll({}, tableModel), }, }; @@ -202,7 +205,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -228,7 +231,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -254,7 +257,21 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) { }, }, { - $project: this.getProject(), + $lookup: { + 'from': 'mygroups', + 'localField': 'groupname', + 'foreignField': 'groupname', + 'as': 'mygrp', + }, + }, + { + $unwind: { + path: '$mygrp', + preserveNullAndEmptyArrays: true, + }, + }, + { + $project: shared_consts.getProjectForAll({}, tableModel), }, /*{ '$lookup': { @@ -280,7 +297,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -313,7 +330,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) { query = [...query, ...objadd.query]; const toadd = { - $project: this.getProject(objadd.proj), + $project: shared_consts.getProjectForAll(objadd.proj, tableModel), }; query = [...query, { ...toadd }]; diff --git a/src/server/models/myskill.js b/src/server/models/myskill.js index b8cabb5..5e38c05 100755 --- a/src/server/models/myskill.js +++ b/src/server/models/myskill.js @@ -13,6 +13,8 @@ const shared_consts = require('../tools/shared_nodejs'); const { ObjectId } = require('mongodb'); +const tableModel = shared_consts.TABLES_MYSKILLS; + // Resolving error Unknown modifier: $pushAll mongoose.plugin(schema => { schema.options.usePushEach = true; @@ -32,6 +34,7 @@ const MySkillSchema = new Schema( required: true, }, userId: { type: Schema.Types.ObjectId, ref: 'User' }, + groupname: { type: String }, idSector: { type: Number, }, @@ -152,7 +155,7 @@ MySkillSchema.statics.executeQueryTable = function (idapp, params, user) { lk_FF: '_id', lk_as: 'user', af_objId_tab: 'myId', - lk_proj: this.getProject(), + lk_proj: shared_consts.getProjectForAll({}, tableModel), }, }; @@ -206,7 +209,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -232,7 +235,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -258,7 +261,21 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $lookup: { + 'from': 'mygroups', + 'localField': 'groupname', + 'foreignField': 'groupname', + 'as': 'mygrp', + }, + }, + { + $unwind: { + path: '$mygrp', + preserveNullAndEmptyArrays: true, + }, + }, + { + $project: shared_consts.getProjectForAll({}, tableModel), }, /*{ '$lookup': { @@ -286,7 +303,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) { }, }, { - $project: this.getProject(), + $project: shared_consts.getProjectForAll({}, tableModel), }, { '$lookup': { @@ -319,7 +336,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) { query = [...query, ...objadd.query]; const toadd = { - $project: this.getProject(objadd.proj), + $project: shared_consts.getProjectForAll(objadd.proj, tableModel), }; query = [...query, { ...toadd }]; diff --git a/src/server/models/user.js b/src/server/models/user.js index 45c72c8..95f3281 100755 --- a/src/server/models/user.js +++ b/src/server/models/user.js @@ -204,9 +204,6 @@ const UserSchema = new mongoose.Schema({ aportador_solidario_ind_order: { type: Number, }, - note: { - type: String, - }, deleted: { type: Boolean, default: false, @@ -360,6 +357,9 @@ const UserSchema = new mongoose.Schema({ biografia: { type: String, }, + note: { + type: String, + }, qualifica: { type: String, }, @@ -1901,6 +1901,7 @@ UserSchema.statics.getUserProfileByUsername = async function ( 'profile.mycircuits': 1, 'profile.qualifica': 1, 'profile.biografia': 1, + 'profile.note': 1, 'profile.teleg_id': 1, 'profile.username_telegram': 1, 'profile.firstname_telegram': 1, @@ -1947,6 +1948,7 @@ UserSchema.statics.getUserProfileByUsername = async function ( 'profile.mycircuits': 1, 'profile.qualifica': 1, 'profile.biografia': 1, + 'profile.note': 1, 'profile.teleg_id': 1, 'profile.username_telegram': 1, 'profile.firstname_telegram': 1, @@ -1994,6 +1996,7 @@ UserSchema.statics.getUserProfileByUsername = async function ( 'profile.mycircuits': 1, 'profile.qualifica': 1, 'profile.biografia': 1, + 'profile.note': 1, 'profile.teleg_id': 1, 'profile.username_telegram': 1, 'profile.firstname_telegram': 1, @@ -3419,6 +3422,7 @@ function getWhatToShow(idapp, username) { 'profile.mycircuits': 1, 'profile.qualifica': 1, 'profile.biografia': 1, + 'profile.note': 1, 'profile.username_telegram': 1, 'profile.firstname_telegram': 1, 'profile.lastname_telegram': 1, @@ -3438,6 +3442,7 @@ function getWhatToShow(idapp, username) { date_reg: 1, 'profile.friends': 1, 'profile.handshake': 1, + 'profile.note': 1, }; } @@ -3461,6 +3466,7 @@ function getWhatToShow_Unknown(idapp, username) { 'profile.resid_card': 1, 'profile.calc': 1, date_reg: 1, + 'profile.note': 1, 'profile.handshake': 1, 'profile.friends': 1, 'profile.favorite': 1, @@ -3494,6 +3500,7 @@ UserSchema.statics.getWhatToShow_IfFriends = async function (idapp, username) { date_reg: 1, groups: 1, 'profile.handshake': 1, + 'profile.note': 1, 'profile.friends': 1, 'profile.favorite': 1, 'profile.bookmark': 1, @@ -5240,6 +5247,7 @@ UserSchema.statics.getQueryLastUsersStretteDiMano = async function (idapp) { profile: { img: "$userfriend.profile.img", resid_province: "$userfriend.profile.resid_province", + note: "$userfriend.profile.note", }, username: "$userfriend.username", name: "$userfriend.name", @@ -5252,6 +5260,7 @@ UserSchema.statics.getQueryLastUsersStretteDiMano = async function (idapp) { img: "$profile.img", handshake: "$profile.handshake", resid_province: "$profile.resid_province", + note: "$profile.note", }, }, handshakeDate: { $first: "$profile.handshake.date" }, @@ -5345,6 +5354,7 @@ UserSchema.statics.getQueryReceiveRISUsers = function (idapp, hours) { idapp: 1, "profile.img": 1, 'profile.handshake': 1, + 'profile.note': 1, }, }, ]; diff --git a/src/server/tools/general.js b/src/server/tools/general.js index 124808b..2526634 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -2864,6 +2864,7 @@ module.exports = { 'user.surname': 1, 'user.profile.img': 1, 'user.profile.qualifica': 1, + 'user.profile.note': 1, }); if (qa1) query = [...query, ...qa1]; query.push({ $unwind: '$user' }); @@ -2913,6 +2914,7 @@ module.exports = { 'user.surname': 1, 'user.profile.img': 1, 'user.profile.qualifica': 1, + 'user.profile.note': 1, }); if (qa1) query = [...query, ...qa1]; query.push({ $unwind: '$user' }); diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js index fb8db2d..2653c2a 100755 --- a/src/server/tools/shared_nodejs.js +++ b/src/server/tools/shared_nodejs.js @@ -51,6 +51,8 @@ module.exports = { FILTER_USER_SENZA_CIRCUITO: 67108864, FILTER_USER_CON_CIRCUITO: 134217728, FILTER_USER_ONLINE_6_MESI: 268435456, + FILTER_NOTE: 536870912, + FILTER_SENZA_NOTE: 1073741824, OPTIONS_SEARCH_ONLY_FULL_WORDS: 1, OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2, @@ -940,13 +942,18 @@ module.exports = { max_partecip: 1, contribstr: 1, link_maplocation: 1, - 'mygrp.groupname': 1, - 'mygrp.title': 1, - 'mygrp.photos': 1, //**ADDFIELD_MYBACHECAS } } + const proj_common = { + 'mygrp.groupname': 1, + 'mygrp.title': 1, + 'mygrp.photos': 1, + } + + proj = Object.assign({}, proj, proj_common); + if (proj_add) proj = Object.assign({}, proj, proj_add); @@ -981,6 +988,7 @@ module.exports = { 'profile.mygroups': 1, 'profile.mycircuits': 1, 'profile.qualifica': 1, + 'profile.note': 1, 'profile.resid_province': 1, 'profile.resid_card': 1, 'profile.username_telegram': 1,