++ aggiunta la prenotazione negli eventi. con la lista degli utenti.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
p Ciao,
|
||||
p Ti avvisiamo che #{username} (#{name} #{surname}) ha appena cancellato la prenotazione per l'evento #{event}:
|
||||
span #{msgbooking}
|
||||
span #{participants}
|
||||
span #{participantsLunch}
|
||||
span #{participantsDinner}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
p Ciao,
|
||||
p Ti confermiamo che #{username} (#{name} #{surname}) ha appena inviato una richiesta di prenotazione per l'evento #{event}
|
||||
p #{msgbooking}
|
||||
p #{participants}
|
||||
p #{participantsLunch}
|
||||
p #{participantsDinner}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
p Ciao,
|
||||
p Ti confermiamo che #{username} (#{name} #{surname}) ha appena Modificato la sua prenotazione per l'evento #{event}
|
||||
p #{msgbooking}
|
||||
p #{participants}
|
||||
p #{participantsLunch}
|
||||
p #{participantsDinner}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
p Ciao #{name},
|
||||
p Ti confermiamo che la prenotazione per l'evento "#{event}" è stata cancellata.
|
||||
p #{msgbooking}
|
||||
p #{participants}
|
||||
p #{participantsLunch}
|
||||
p #{participantsDinner}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
p Ciao #{name},
|
||||
p Ti confermiamo che hai appena inviato una richiesta di prenotazione per l'evento #{event}
|
||||
p #{msgbooking}
|
||||
p #{participants}
|
||||
p #{participantsLunch}
|
||||
p #{participantsDinner}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
p Ciao #{name},
|
||||
p Ti confermiamo che hai modificato la prenotazione per l'evento #{event}
|
||||
p #{msgbooking}
|
||||
p #{participants}
|
||||
p #{participantsLunch}
|
||||
p #{participantsDinner}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"NEW_GOOD": "<strong>%s</strong> ha aggiunto un nuovo Bene: %s",
|
||||
"NEW_SERVICE": "<strong>%s</strong> ha aggiunto un nuovo Servizio: %s",
|
||||
"NEW_HOSP": "<strong>%s</strong> ha aggiunto una nuova Ospitalità: %s",
|
||||
"NEW_EVENT": "<strong>%s</strong> ha aggiunto un nuovo Evento: %s",
|
||||
"OPEN PAGE": "<em>APRI la APP RISO oppure visita riso.app</em>",
|
||||
"<strong>%s</strong> asked you for Friendship": "<strong>%s</strong> ti ha chiesto l'Amicizia",
|
||||
"<strong>%s</strong> accepted your Friendship": "<strong>%s</strong> ha accettato l'Amicizia",
|
||||
@@ -88,5 +89,8 @@
|
||||
"FIDOCONCESSO_VARIATO": "[Circuito %s] l'utente %s ha variato il Fido Concesso di %s da %s a %s %s",
|
||||
"QTAMAX_VARIATO": "[Circuito %s] l'utente %s ha variato la quantità massima concessa di %s da %s a %s %s",
|
||||
"SET_FAVORITE": "%s ha messo 'Mi Piace' al tuo post: %s",
|
||||
"SET_FAVORITE_OTHERS": "%s e altre %s persone hanno messo 'Mi Piace' al tuo post: %s"
|
||||
"SET_FAVORITE_OTHERS": "%s e altre %s persone hanno messo 'Mi Piace' al tuo post: %s",
|
||||
"EVENT_SEND_MSG": "%s ha mandato un messaggio sull'evento %s: \n%s",
|
||||
"SET_ATTEND": "%s ha detto che Parteciperà all'evento: %s",
|
||||
"SET_ATTEND_OTHERS": "%s e altre %s persone hanno detto che Parteciperanno all'evento: %s"
|
||||
}
|
||||
@@ -20,6 +20,12 @@ const bookingSchema = new Schema({
|
||||
userId: {
|
||||
type: String,
|
||||
},
|
||||
username: {
|
||||
type: String,
|
||||
},
|
||||
tableType: {
|
||||
type: Number,
|
||||
},
|
||||
id_bookedevent: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -9,6 +9,8 @@ const tools = require('../tools/general');
|
||||
const { ObjectID } = require('mongodb');
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const tableModel = shared_consts.TABLES_MYBACHECAS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true;
|
||||
@@ -26,6 +28,7 @@ const MyBachecaSchema = new Schema({
|
||||
required: true,
|
||||
},
|
||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||
groupname: { type: String },
|
||||
idSector: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -51,6 +54,30 @@ const MyBachecaSchema = new Schema({
|
||||
dateTimeEnd: {
|
||||
type: Date,
|
||||
},
|
||||
organisedBy: {
|
||||
type: String
|
||||
},
|
||||
contact_phone: {
|
||||
type: String
|
||||
},
|
||||
contact_telegram: {
|
||||
type: String
|
||||
},
|
||||
address: {
|
||||
type: String,
|
||||
},
|
||||
min_partecip: {
|
||||
type: Number,
|
||||
},
|
||||
max_partecip: {
|
||||
type: Number,
|
||||
},
|
||||
link_maplocation: {
|
||||
type: String,
|
||||
},
|
||||
contribstr: {
|
||||
type: String,
|
||||
},
|
||||
numLevel: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
@@ -137,7 +164,7 @@ MyBachecaSchema.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),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -151,25 +178,21 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
|
||||
let myparsid = {
|
||||
'_id': id,
|
||||
idapp,
|
||||
};
|
||||
|
||||
let query = [
|
||||
{
|
||||
'$match':
|
||||
$match:
|
||||
myparsid,
|
||||
},
|
||||
{
|
||||
'$match': {
|
||||
'idapp': idapp,
|
||||
$sort: {
|
||||
desc: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$sort': {
|
||||
'desc': 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$addFields': {
|
||||
$addFields: {
|
||||
'myId1': {
|
||||
'$toObjectId': '$userId',
|
||||
},
|
||||
@@ -199,7 +222,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': this.getProject(),
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -225,7 +248,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': this.getProject(),
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -251,7 +274,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': this.getProject(),
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
/*{
|
||||
'$lookup': {
|
||||
@@ -277,7 +300,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': this.getProject(),
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -304,42 +327,26 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
];
|
||||
|
||||
try {
|
||||
let numtab = tools.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
||||
|
||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
query = query.push(
|
||||
{
|
||||
$project: this.getProject(objadd.proj),
|
||||
const toadd = {
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
} catch (e) {
|
||||
console.error('e', e);
|
||||
}
|
||||
);
|
||||
|
||||
return MyBacheca.aggregate(query).then((rec) => {
|
||||
return rec ? rec[0] : null;
|
||||
});
|
||||
};
|
||||
|
||||
MyBachecaSchema.statics.getProject = function (proj_add2) {
|
||||
let proj = {
|
||||
recSkill: 1,
|
||||
sector: 1,
|
||||
idSector: 1,
|
||||
idSkill: 1,
|
||||
// 'idSubSkill': 1,
|
||||
idStatusSkill: 1,
|
||||
idContribType: 1,
|
||||
dateTimeStart: 1,
|
||||
dateTimeEnd: 1,
|
||||
website: 1,
|
||||
//**ADDFIELD_MYBACHECAS
|
||||
};
|
||||
|
||||
const proj_add = shared_consts.getProjectForAll(proj_add2)
|
||||
|
||||
return Object.assign({}, proj, proj_add);
|
||||
|
||||
}
|
||||
|
||||
MyBachecaSchema.statics.getCompleteRecord = function (idapp, id) {
|
||||
const MyBacheca = this;
|
||||
|
||||
@@ -150,6 +150,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
|
||||
let myparsid = {
|
||||
'_id': idGood,
|
||||
idapp,
|
||||
};
|
||||
|
||||
let query = [
|
||||
@@ -157,11 +158,6 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
'$match':
|
||||
myparsid,
|
||||
},
|
||||
{
|
||||
'$match': {
|
||||
'idapp': idapp,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$sort': {
|
||||
'desc': 1,
|
||||
@@ -309,11 +305,11 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
query = [...query,
|
||||
{
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
query = [...query, {...toadd}];
|
||||
|
||||
return MyGood.aggregate(query).then((rec) => {
|
||||
return rec ? rec[0] : null;
|
||||
|
||||
@@ -149,18 +149,13 @@ MyHospSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
const MyHosp = this;
|
||||
|
||||
const myparsid = { '_id': id };
|
||||
const myparsid = { '_id': id, idapp };
|
||||
|
||||
let query = [
|
||||
{
|
||||
'$match':
|
||||
myparsid,
|
||||
},
|
||||
{
|
||||
'$match': {
|
||||
'idapp': idapp,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$sort': {
|
||||
'desc': 1,
|
||||
@@ -307,11 +302,11 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
query = [...query,
|
||||
{
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
query = [...query, {...toadd}];
|
||||
|
||||
return MyHosp.aggregate(query).then((rec) => {
|
||||
return rec ? rec[0] : null;
|
||||
|
||||
@@ -156,12 +156,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
||||
let query = [
|
||||
{
|
||||
'$match': {
|
||||
'_id': idSkill,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$match': {
|
||||
'idapp': idapp,
|
||||
'_id': idSkill, idapp
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -312,11 +307,11 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
query = [...query,
|
||||
{
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
query = [...query, {...toadd}];
|
||||
|
||||
return MySkill.aggregate(query).then((rec) => {
|
||||
return rec ? rec[0] : null;
|
||||
|
||||
@@ -17,14 +17,14 @@ const sendmsgSchema = new Schema({
|
||||
},
|
||||
source: {
|
||||
page: { type: String },
|
||||
event_id: { type: String }
|
||||
event_id: { type: String },
|
||||
infoevent: { type: String }
|
||||
},
|
||||
origin: {
|
||||
username: { type: String },
|
||||
type: String,
|
||||
},
|
||||
dest: {
|
||||
idapp: { type: String, },
|
||||
username: { type: String },
|
||||
type: String,
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
@@ -54,7 +54,7 @@ sendmsgSchema.statics.findAllMsgByUsernameIdAndIdApp = function (username, lastd
|
||||
|
||||
return SendMsg.find({
|
||||
$and: [
|
||||
{ $or: [ { 'dest.username': username }, { 'origin.username': username },] },
|
||||
{ $or: [ { 'dest': username }, { 'origin': username },] },
|
||||
{ 'datemsg': {$gt: new Date(lastdataread)} },
|
||||
{ idapp }
|
||||
]
|
||||
@@ -73,14 +73,14 @@ sendmsgSchema.statics.findLastGroupByUserIdAndIdApp = function (userId, username
|
||||
return SendMsg.aggregate([
|
||||
{
|
||||
$match: {
|
||||
$or: [{ 'origin.username': username }, { 'dest.username': username }, { idapp }],
|
||||
$or: [{ 'origin': username }, { 'dest': username }, { idapp }],
|
||||
$and: [{ idapp }]
|
||||
}
|
||||
},
|
||||
{
|
||||
$group:
|
||||
{
|
||||
_id: "$dest.username",
|
||||
_id: "$dest",
|
||||
message: { $last: "$message" },
|
||||
datemsg: { $last: "$datemsg" },
|
||||
dest: { $last: "$dest" },
|
||||
|
||||
@@ -194,7 +194,28 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYHOSPS, true) + myidrec;
|
||||
tag = 'newhosp';
|
||||
}
|
||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYBACHECAS, true) + myidrec;
|
||||
tag = 'newevent';
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_NEW_REC) {
|
||||
newdescr = i18n.__('NEW_EVENT', userorig, mydescr);
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_SEND_MSG) {
|
||||
newdescr = i18n.__('EVENT_SEND_MSG', userorig, recnotif.title, recnotif.msg);
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_ATTEND) {
|
||||
// ++ Controlla se esiste già
|
||||
let esitegia = recnotif.paramsObj.recObjCreator.exist; // ++
|
||||
|
||||
if (esitegia)
|
||||
newdescr = i18n.__('SET_ATTEND_OTHERS', recnotif.paramsObj.username_action, recnotif.paramsObj.recObjCreator.numattend - 1, recnotif.paramsObj.recObjCreator.descr);
|
||||
else
|
||||
newdescr = i18n.__('SET_ATTEND', recnotif.paramsObj.username_action, recnotif.paramsObj.recObjCreator.descr);
|
||||
|
||||
tag = 'attend';
|
||||
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(recnotif.paramsObj.recObjCreator.table, true) + recnotif.paramsObj.recObjCreator.id;
|
||||
recnotif.textaddTelegram = 'Vedi post';
|
||||
}
|
||||
|
||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
|
||||
recnotif.openUrl = '/my/' + sender;
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_FRIENDS_NEW_REC) {
|
||||
@@ -562,7 +583,10 @@ sendNotifSchema.statics.saveAndSendNotif = async function (myrecnotif, req, res,
|
||||
const myrecread = await SendNotif.findById(idobj).lean();
|
||||
// console.log('myrecread._id', myrecread._id.toString());
|
||||
|
||||
if (myrecread)
|
||||
return await globalTables.sendNotif(myrecread.typedir, myrecread.typeid, res, idapp, user ? user : req.user, myrecread);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@@ -666,8 +690,6 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
|
||||
|
||||
newstatus = shared_consts.CircuitsNotif.STATUS_COINS_REFUSED_SENT;
|
||||
}
|
||||
} else if (myrecnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FAVORITE) {
|
||||
// typeidsearch = shared_consts.TypeNotifs.ID_FAVORITE_ADDED;
|
||||
}
|
||||
|
||||
if (newstatus) {
|
||||
@@ -934,6 +956,13 @@ sendNotifSchema.statics.sendToTheDestinations = async function (myrecnotifpass,
|
||||
let send = false;
|
||||
|
||||
|
||||
if (myrecnotifpass.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
|
||||
if (myrecnotifpass.tablerec === shared_consts.TABLES_MYBACHECAS) {
|
||||
if (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_EVENTS_ATTEND)) {
|
||||
send = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myrecnotifpass.typedir === shared_consts.TypeNotifs.TYPEDIR_FAVORITE) {
|
||||
if (shared_consts.TABLES_FAVORITE_BOOKMARK.includes(myrecnotifpass.tablerec)) {
|
||||
if (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_FAVORITE_ADDED)) {
|
||||
|
||||
@@ -473,6 +473,14 @@ const UserSchema = new mongoose.Schema({
|
||||
tab: { type: Number },
|
||||
},
|
||||
],
|
||||
attend: [
|
||||
{
|
||||
_id: false,
|
||||
id: { type: String },
|
||||
tab: { type: Number },
|
||||
num: { type: Number },
|
||||
},
|
||||
],
|
||||
version: { type: Number },
|
||||
},
|
||||
});
|
||||
@@ -1614,6 +1622,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
||||
'profile.friends': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
email: 1,
|
||||
date_reg: 1,
|
||||
@@ -1661,6 +1670,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
||||
'profile.friends': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
email: 1,
|
||||
date_reg: 1,
|
||||
@@ -1709,6 +1719,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
||||
'profile.friends': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
'mycities': 1,
|
||||
'comune': 1,
|
||||
@@ -1943,6 +1954,29 @@ UserSchema.statics.addFavorite = async function (
|
||||
|
||||
return ris;
|
||||
};
|
||||
|
||||
// Aggiungo il Partecipa
|
||||
UserSchema.statics.addAttend = async function (
|
||||
req, idapp, username, id, tab, num) {
|
||||
const ris = await User.updateOne({ idapp, username },
|
||||
{ $push: { 'profile.attend': { id, tab, num } } });
|
||||
|
||||
const { SendNotif } = require('../models/sendnotif');
|
||||
|
||||
const globalTables = require('../tools/globalTables');
|
||||
|
||||
// Invia una Notifica al Destinatario
|
||||
const recObjCreator = await globalTables.getUserCreatorByNumTabAndId(idapp, id, tab);
|
||||
|
||||
if (recObjCreator) {
|
||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: recObjCreator.username, recObjCreator, username_action: req.user.username }, false,
|
||||
shared_consts.TypeNotifs.TYPEDIR_EVENTS,
|
||||
shared_consts.TypeNotifs.ID_EVENTS_ATTEND);
|
||||
|
||||
}
|
||||
|
||||
return ris;
|
||||
};
|
||||
// Rimuovo il Bookmark
|
||||
UserSchema.statics.removeBookmark = async function (
|
||||
idapp, username, id, tab) {
|
||||
@@ -1956,6 +1990,13 @@ UserSchema.statics.addBookmark = async function (
|
||||
return await User.updateOne({ idapp, username },
|
||||
{ $push: { 'profile.bookmark': { id, tab } } });
|
||||
};
|
||||
// Rimuovo il Partecipa
|
||||
UserSchema.statics.removeAttend = async function (
|
||||
idapp, username, id, tab) {
|
||||
return await User.updateOne({ idapp, username },
|
||||
{ $pull: { 'profile.attend': { id: { $in: [id] }, tab } } });
|
||||
};
|
||||
|
||||
// Aggiungo il Bookmark
|
||||
UserSchema.statics.addSeen = async function (
|
||||
idapp, username, id, tab) {
|
||||
@@ -2816,6 +2857,7 @@ function getWhatToShow(idapp, username) {
|
||||
'profile.handshake': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
};
|
||||
|
||||
@@ -2842,6 +2884,7 @@ function getWhatToShow_Unknown(idapp, username) {
|
||||
'profile.friends': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
}
|
||||
}
|
||||
@@ -2871,6 +2914,7 @@ UserSchema.statics.getWhatToShow_IfFriends = async function (idapp, username) {
|
||||
'profile.friends': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
};
|
||||
|
||||
@@ -4724,11 +4768,13 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
|
||||
versattualeuser = recUser.profile.version;
|
||||
}
|
||||
|
||||
versattualeuser = 0;
|
||||
|
||||
if (versattualeuser < version) {
|
||||
// Aggiornamento versione
|
||||
recUser = await User.updateVersion(versattualeuser, recUser);
|
||||
|
||||
await User.findOneAndUpdate({_id: recUser._id}, {$set: { 'profile.version' : version }});
|
||||
await User.findOneAndUpdate({ _id: recUser._id }, { $set: { 'profile.version': version } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4828,19 +4874,32 @@ UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
||||
recUser.profile.notifs = shared_consts.DEFAULT_NOTIFS_USER;
|
||||
}
|
||||
|
||||
const recfavoriteNotif = recUser.profile.notifs.find((rec) => rec.dir === 11);
|
||||
if (!recfavoriteNotif){
|
||||
recUser.profile.notifs.push( { dir: 11, value: 1 })
|
||||
const recfavoriteNotif = recUser.profile.notifs.find((rec) => rec.dir === shared_consts.TypeNotifs.TYPEDIR_FAVORITE);
|
||||
if (!recfavoriteNotif) {
|
||||
recUser.profile.notifs.push({ dir: shared_consts.TypeNotifs.TYPEDIR_FAVORITE, value: shared_consts.TypeNotifs.ID_FAVORITE_ADDED })
|
||||
}
|
||||
|
||||
const recAttendNotif = recUser.profile.notifs.find((rec) => rec.dir === shared_consts.TypeNotifs.TYPEDIR_EVENTS);
|
||||
if (recAttendNotif) {
|
||||
if (!tools.isBitActive(recAttendNotif.value, shared_consts.TypeNotifs.ID_EVENTS_ATTEND)) {
|
||||
recAttendNotif.value = tools.SetBit(recAttendNotif.value, shared_consts.TypeNotifs.ID_EVENTS_ATTEND);
|
||||
}
|
||||
|
||||
for (let i = 0; i < recUser.profile.notifs.length; i++) {
|
||||
if (recUser.profile.notifs[i].dir === shared_consts.TypeNotifs.TYPEDIR_EVENTS)
|
||||
recUser.profile.notifs[i].value = recAttendNotif.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Imposta la provincia, se non l'ho messa, in base al bene o servizio che hai messo.
|
||||
if (!recUser.profile.resid_province) {
|
||||
let resid_province = '';
|
||||
const firstrec = await MySkill.findOne({userId: recUser._id}).lean();
|
||||
const firstrec = await MySkill.findOne({ userId: recUser._id }).lean();
|
||||
if (firstrec && firstrec.idCity && firstrec.idCity.length > 0) {
|
||||
resid_province = await City.getProvinceByIdCity(firstrec.idCity[0]);
|
||||
} else {
|
||||
const firstrec = await MyGood.findOne({userId: recUser._id}).lean();
|
||||
const firstrec = await MyGood.findOne({ userId: recUser._id }).lean();
|
||||
if (firstrec && firstrec.idCity && firstrec.idCity.length === 1) {
|
||||
resid_province = await City.getProvinceByIdCity(firstrec.idCity[0]);
|
||||
}
|
||||
@@ -4848,7 +4907,7 @@ UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
||||
|
||||
|
||||
if (resid_province) {
|
||||
await User.findOneAndUpdate({_id: recUser._id}, {$set: {'profile.resid_province': resid_province}});
|
||||
await User.findOneAndUpdate({ _id: recUser._id }, { $set: { 'profile.resid_province': resid_province } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4861,7 +4920,7 @@ UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
||||
}
|
||||
}
|
||||
|
||||
await User.findOneAndUpdate({_id: recUser._id}, {$set: { 'profile.notifs': recUser.profile.notifs }});
|
||||
await User.findOneAndUpdate({ _id: recUser._id }, { $set: { 'profile.notifs': recUser.profile.notifs } });
|
||||
}
|
||||
|
||||
return recUser;
|
||||
|
||||
@@ -10,7 +10,7 @@ const { User } = require('../models/user');
|
||||
const { Operator } = require('../models/operator');
|
||||
const { SendMsg } = require('../models/sendmsg');
|
||||
|
||||
const {SendNotif} = require('../models/sendnotif');
|
||||
const { SendNotif } = require('../models/sendnotif');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
@@ -35,7 +35,7 @@ router.post('/', authenticate, (req, res) => {
|
||||
User.setOnLine(req.user.idapp, req.user.username);
|
||||
}
|
||||
|
||||
const check = tools.checkUserOk(myrecmsg.origin.username, req.user.username, res);
|
||||
const check = tools.checkUserOk(myrecmsg.origin, req.user.username, res);
|
||||
if (check.exit) return check.ret;
|
||||
|
||||
// console.log('fieldtochange', fieldtochange);
|
||||
@@ -49,26 +49,37 @@ router.post('/', authenticate, (req, res) => {
|
||||
|
||||
return SendMsg.findById(idobj)
|
||||
.then(async (recmsg) => {
|
||||
const myrecsend = new SendNotif(
|
||||
{
|
||||
title: recmsg.source.infoevent,
|
||||
sender: recmsg.origin,
|
||||
dest: recmsg.dest,
|
||||
openUrl: '',
|
||||
});
|
||||
// Add this field because I don't want to add into the database
|
||||
recmsg.source.infoevent = body.source.infoevent;
|
||||
// myrecsend.source.infoevent = body.source.infoevent;
|
||||
|
||||
recmsg.typedir = shared_consts.TypeNotifs.TYPEDIR_EVENTS;
|
||||
recmsg.typeid = shared_consts.TypeNotifs.ID_EVENTS_REMOVE_REC;
|
||||
myrecsend.typedir = shared_consts.TypeNotifs.TYPEDIR_EVENTS;
|
||||
myrecsend.typeid = shared_consts.TypeNotifs.ID_EVENTS_SEND_MSG;
|
||||
myrecsend.msg = recmsg.message;
|
||||
let myid = recmsg._id;
|
||||
// ##Todo !! DA SISTEMARE !!!
|
||||
return await SendNotif.saveAndSendNotif(recmsg, req, res).then((out) => {
|
||||
return await SendNotif.saveAndSendNotif(myrecsend, req, res).then((out) => {
|
||||
if (out)
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, msg: '', id: recmsg._id });
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, msg: '', id: myid });
|
||||
else
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, msg: '' });
|
||||
})
|
||||
|
||||
});
|
||||
}).catch((e) => {
|
||||
console.log(e.message);
|
||||
console.error(e.message);
|
||||
// res.status(400).send(e);
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, msg: '' });
|
||||
// return res.send({ code: server_constants.RIS_CODE_ERR, msg: '' });
|
||||
})
|
||||
|
||||
let fine = '';
|
||||
|
||||
});
|
||||
|
||||
router.get('/:username/:lastdataread/:idapp', authenticate, (req, res) => {
|
||||
|
||||
@@ -1547,12 +1547,14 @@ router.post('/cmd', authenticate, async (req, res) => {
|
||||
const cmd = req.body.cmd;
|
||||
const id = req.body.id;
|
||||
const tab = req.body.tab;
|
||||
const num = req.body.num;
|
||||
const value = req.body.value;
|
||||
|
||||
try {
|
||||
const username = req.user.username;
|
||||
|
||||
let ris = null;
|
||||
let record = null;
|
||||
|
||||
if (cmd === shared_consts.CMD_USER.SET_FAVORITE) {
|
||||
if (tab) {
|
||||
@@ -1568,16 +1570,29 @@ router.post('/cmd', authenticate, async (req, res) => {
|
||||
else
|
||||
ris = await User.removeBookmark(idapp, username, id, tab);
|
||||
}
|
||||
} else if (cmd === shared_consts.CMD_USER.SET_SEEN) {
|
||||
} else if (cmd === shared_consts.CMD_USER.SET_ATTEND) {
|
||||
if (tab) {
|
||||
if (value)
|
||||
ris = await User.addAttend(req, idapp, username, id, tab, num);
|
||||
else
|
||||
ris = await User.removeAttend(idapp, username, id, tab);
|
||||
}
|
||||
} else if (cmd === shared_consts.CMD_USER.SET_SEEN) {
|
||||
if (tab) {
|
||||
if (value) {
|
||||
ris = await User.addSeen(idapp, username, id, tab);
|
||||
}
|
||||
const tabtofind = tools.getNumTabByTable('mybachecas');
|
||||
if (tab === tabtofind) {
|
||||
const { MyBacheca } = require('../models/mybacheca');
|
||||
record = await MyBacheca.getCompleteRecord(idapp, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let state = (value && ris && ris.ok === 1) ? 1 : ((!value && ris && ris.ok === 1) ? -1 : 0);
|
||||
|
||||
return res.send({ state });
|
||||
return res.send({ state, record });
|
||||
|
||||
} catch (e) {
|
||||
res.status(400).send();
|
||||
|
||||
@@ -299,6 +299,7 @@ module.exports = {
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
emailto: emailto,
|
||||
msgbooking: '',
|
||||
participants: '',
|
||||
participantsLunch: '',
|
||||
participantsDinner: '',
|
||||
@@ -347,6 +348,10 @@ module.exports = {
|
||||
|
||||
msgtelegram += '\n';
|
||||
|
||||
if (recbooking.msgbooking) {
|
||||
mylocalsconf.msgbooking = 'Messaggio: ' + recbooking.msgbooking.toString()
|
||||
msgtelegram += mylocalsconf.msgbooking + '\n';
|
||||
}
|
||||
if (recbooking.numpeople > 0) {
|
||||
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + tools.getres__('partecipanti', res);
|
||||
msgtelegram += mylocalsconf.participants + '\n';
|
||||
|
||||
@@ -679,7 +679,9 @@ module.exports = {
|
||||
return [
|
||||
'idapp',
|
||||
'userId',
|
||||
'username',
|
||||
'id_bookedevent',
|
||||
'tableType',
|
||||
'numpeople',
|
||||
'numpeopleLunch',
|
||||
'numpeopleDinner',
|
||||
@@ -1455,8 +1457,9 @@ module.exports = {
|
||||
} else {
|
||||
return {
|
||||
exit: true,
|
||||
ret: res.status(404).
|
||||
send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER }),
|
||||
ret: false,
|
||||
// ret: res.status(404).
|
||||
// send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER }),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
@@ -1836,7 +1839,19 @@ module.exports = {
|
||||
foreignField: params.lk_FF, // field in the 'from' collection
|
||||
as: params.lk_as,
|
||||
},
|
||||
},
|
||||
});
|
||||
if (params.unwind) {
|
||||
|
||||
query.push({
|
||||
$unwind: {
|
||||
path: '$' + params.lk_as,
|
||||
preserveNullAndEmptyArrays: true,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!params.noarray) {
|
||||
query.push(
|
||||
{
|
||||
$replaceRoot: {
|
||||
newRoot: {
|
||||
@@ -1847,7 +1862,10 @@ module.exports = {
|
||||
}, '$$ROOT'],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
query.push(
|
||||
{ $project: proj },
|
||||
);
|
||||
}
|
||||
@@ -2012,21 +2030,148 @@ module.exports = {
|
||||
as: 'myseen',
|
||||
},
|
||||
},
|
||||
];
|
||||
{
|
||||
$lookup: {
|
||||
from: "users",
|
||||
let: {
|
||||
tab: numtab,
|
||||
id: '$_id',
|
||||
},
|
||||
pipeline: [
|
||||
{
|
||||
$unwind: '$profile.attend',
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
$expr: {
|
||||
$and: [
|
||||
{ $eq: ['$profile.attend.id', '$$id'] },
|
||||
{ $eq: ['$profile.attend.tab', '$$tab'] },
|
||||
{ $eq: ['$idapp', idapp] },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
||||
'profile.qualifica': 1,
|
||||
}
|
||||
},
|
||||
],
|
||||
as: 'myattend',
|
||||
},
|
||||
}];
|
||||
|
||||
const numtabbacheca = this.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
||||
if (numtab === numtabbacheca) {
|
||||
const queryadd = this.getQueryMyBacheca();
|
||||
query = [...query, ...queryadd];
|
||||
}
|
||||
|
||||
proj = {
|
||||
myfav: 1,
|
||||
mybook: 1,
|
||||
myseen: 1,
|
||||
myattend: 1,
|
||||
mybookings: 1,
|
||||
};
|
||||
|
||||
return { query, proj };
|
||||
},
|
||||
|
||||
getQueryMyBacheca: function () {
|
||||
|
||||
const arrquery = [{
|
||||
$lookup: {
|
||||
from: "bookings",
|
||||
let: {
|
||||
id: '$_id',
|
||||
},
|
||||
pipeline: [
|
||||
{
|
||||
$match: {
|
||||
$expr: {
|
||||
$and: [
|
||||
{ $eq: ['$id_bookedevent', '$$id'] },
|
||||
{ $eq: ['$idapp', idapp] },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
id_bookedevent: 1,
|
||||
username: 1,
|
||||
numpeople: 1,
|
||||
numpeopleLunch: 1,
|
||||
numpeopleDinner: 1,
|
||||
infoevent: 1,
|
||||
msgbooking: 1,
|
||||
booked: 1,
|
||||
datebooked: 1,
|
||||
userId: 1,
|
||||
}
|
||||
},
|
||||
],
|
||||
as: 'mybookings',
|
||||
},
|
||||
},
|
||||
/**
|
||||
{
|
||||
$lookup: {
|
||||
from: "users",
|
||||
localField: "myId1",
|
||||
foreignField: "_id",
|
||||
as: "user",
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: "users",
|
||||
let: {
|
||||
myid: { $toObjectId: "$mybookings.userId" },
|
||||
},
|
||||
pipeline: [
|
||||
{
|
||||
$match: {
|
||||
$expr: {
|
||||
$and: [
|
||||
{
|
||||
$eq: [
|
||||
"$_id",
|
||||
"$$myid",
|
||||
],
|
||||
},
|
||||
{
|
||||
$eq: [
|
||||
"$idapp",
|
||||
"13",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: { _id: 1, username: 1 },
|
||||
}
|
||||
],
|
||||
|
||||
as: "myuser",
|
||||
},
|
||||
}**/
|
||||
|
||||
];
|
||||
|
||||
return arrquery;
|
||||
|
||||
},
|
||||
|
||||
getQueryTable: async function (idapp, params, user) {
|
||||
|
||||
|
||||
const { Search }= require('../models/search');
|
||||
const { Search } = require('../models/search');
|
||||
|
||||
if (typeof params.startRow !== 'number') {
|
||||
throw new Error('startRow must be number');
|
||||
@@ -2610,7 +2755,7 @@ module.exports = {
|
||||
|
||||
// Save the search:
|
||||
if (user._id) {
|
||||
const mysearch = new Search({idapp, userId: user._id, text: params.filter});
|
||||
const mysearch = new Search({ idapp, userId: user._id, text: params.filter });
|
||||
await mysearch.save();
|
||||
}
|
||||
}
|
||||
@@ -3875,7 +4020,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
updateQueryStringParameter(uri, key, value) {
|
||||
if (uri === '')
|
||||
if (uri === '' || !uri)
|
||||
return '';
|
||||
var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
||||
var separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
||||
|
||||
@@ -592,6 +592,50 @@ module.exports = {
|
||||
|
||||
},
|
||||
|
||||
getNumAttendByIdObj: async function (idapp, numtab, id) {
|
||||
|
||||
const { User } = require('../models/user');
|
||||
|
||||
let query = [
|
||||
{
|
||||
$match: {
|
||||
idapp,
|
||||
"profile.attend": {
|
||||
$elemMatch:
|
||||
{ id, tab: numtab }
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
$group:
|
||||
{
|
||||
_id: null,
|
||||
count: {
|
||||
$sum:
|
||||
{
|
||||
$reduce: {
|
||||
input: "$profile.attend",
|
||||
initialValue: 0,
|
||||
in: {
|
||||
$add: ["$$value", "$$this.num"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
{ $project: { _id: 0 } }
|
||||
];
|
||||
|
||||
try {
|
||||
const [result] = await User.aggregate(query);
|
||||
|
||||
return result ? result.count : 0;
|
||||
} catch (err) {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
getUserCreatorByNumTabAndId: async function (idapp, id, numtab) {
|
||||
try {
|
||||
const table = tools.getTableByNumTab(numtab);
|
||||
@@ -604,10 +648,15 @@ module.exports = {
|
||||
if (rec) {
|
||||
const recuser = await User.getUserById(idapp, rec.userId);
|
||||
|
||||
let numattend = await this.getNumAttendByIdObj(idapp, numtab, id);
|
||||
let numfav = await this.getNumFavoriteByIdObj(idapp, numtab, id);
|
||||
let exist = numfav > 1;
|
||||
let exist = false;
|
||||
if (table === shared_consts.TABLES_MYBACHECAS)
|
||||
exist = numattend > 1;
|
||||
else
|
||||
exist = numfav > 1;
|
||||
if (recuser)
|
||||
return { userId: rec.userId, username: recuser.username, descr: rec.descr, id: rec._id, table, exist, numfav };
|
||||
return { userId: rec.userId, username: recuser.username, descr: rec.descr, id: rec._id, table, exist, numfav, numattend };
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -138,18 +138,21 @@ module.exports = {
|
||||
TABLES_MYHOSPS: 'myhosps',
|
||||
TABLES_MYGOODS: 'mygoods',
|
||||
TABLES_MYEVENTS: 'myevents',
|
||||
TABLES_CIRCUITS: 'circuits',
|
||||
TABLES_MYGROUPS: 'mygroups',
|
||||
|
||||
MYTABS: [{id: 0, table: 'none' },
|
||||
{id: 1, table: 'myskills'},
|
||||
{id: 2, table: 'mybachecas' },
|
||||
{id: 3, table: 'myhosps'} ,
|
||||
{id: 4, table: 'mygoods'},
|
||||
{id: 5, table: 'myevents'}],
|
||||
MYTABS: [{ id: 0, table: 'none' },
|
||||
{ id: 1, table: 'myskills' },
|
||||
{ id: 2, table: 'mybachecas' },
|
||||
{ id: 3, table: 'myhosps' },
|
||||
{ id: 4, table: 'mygoods' },
|
||||
{ id: 5, table: 'myevents' }],
|
||||
|
||||
CMD_USER: {
|
||||
SET_FAVORITE: 1,
|
||||
SET_BOOKMARK: 2,
|
||||
SET_SEEN: 3,
|
||||
SET_ATTEND: 4,
|
||||
},
|
||||
|
||||
TABLES_ENABLE_GETREC_BYID: ['mybachecas', 'myhosps', 'myskills', 'mygoods'],
|
||||
@@ -171,7 +174,7 @@ module.exports = {
|
||||
TABLES_GROUPS_NOTIFICATION: ['mygroups'],
|
||||
TABLES_CIRCUITS_NOTIFICATION: ['circuits'],
|
||||
|
||||
TABLES_NUM_AS_ID_NUMBER: [ ],
|
||||
TABLES_NUM_AS_ID_NUMBER: [],
|
||||
|
||||
TABLES_ID_STRING: [
|
||||
'circuits',
|
||||
@@ -212,19 +215,19 @@ module.exports = {
|
||||
table: 'adtypes',
|
||||
key: 'descr',
|
||||
},
|
||||
{table: 'catgrps', key: 'descr'},
|
||||
{ table: 'catgrps', key: 'descr' },
|
||||
{
|
||||
table: 'contribtypes',
|
||||
key: 'descr',
|
||||
},
|
||||
{table: 'goods', key: 'descr'},
|
||||
{table: 'levels', key: 'descr'},
|
||||
{table: 'cities', key: 'comune'},
|
||||
{table: 'provinces', key: 'descr'},
|
||||
{table: 'sectorgoods', key: 'descr'},
|
||||
{table: 'sectors', key: 'descr'},
|
||||
{table: 'skills', key: 'descr'},
|
||||
{table: 'statusSkills', key: 'descr'},
|
||||
{ table: 'goods', key: 'descr' },
|
||||
{ table: 'levels', key: 'descr' },
|
||||
{ table: 'cities', key: 'comune' },
|
||||
{ table: 'provinces', key: 'descr' },
|
||||
{ table: 'sectorgoods', key: 'descr' },
|
||||
{ table: 'sectors', key: 'descr' },
|
||||
{ table: 'skills', key: 'descr' },
|
||||
{ table: 'statusSkills', key: 'descr' },
|
||||
],
|
||||
|
||||
VISIB_ALL: 0,
|
||||
@@ -411,6 +414,8 @@ module.exports = {
|
||||
TYPEDIR_EVENTS: 2,
|
||||
ID_EVENTS_NEW_REC: 1,
|
||||
ID_EVENTS_REMOVE_REC: 2,
|
||||
ID_EVENTS_ATTEND: 4,
|
||||
ID_EVENTS_SEND_MSG: 8,
|
||||
|
||||
TYPEDIR_FRIENDS: 3,
|
||||
ID_FRIENDS_NEW_REC: 1,
|
||||
@@ -464,7 +469,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
|
||||
// Tipi di Notifiche:
|
||||
// Tipi di Notifiche:
|
||||
/*
|
||||
Notif: {
|
||||
UPDATE_APP: 1,
|
||||
@@ -520,7 +525,7 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
'dir': 2,
|
||||
'value': 1
|
||||
'value': 4
|
||||
},
|
||||
{
|
||||
'dir': 3,
|
||||
@@ -538,6 +543,10 @@ module.exports = {
|
||||
'dir': 11,
|
||||
'value': 1
|
||||
},
|
||||
{
|
||||
'dir': 12,
|
||||
'value': 1
|
||||
},
|
||||
],
|
||||
|
||||
CIRCUIT_STATUS: {
|
||||
@@ -554,7 +563,149 @@ module.exports = {
|
||||
SCOPERTO_MAX_CONTO_COMUNITARIO: 1000,
|
||||
},
|
||||
|
||||
getProjectForAll(proj_add) {
|
||||
TABLETYPE: {
|
||||
DefaultCal: 0,
|
||||
MyBachecas: 1,
|
||||
},
|
||||
|
||||
getProjectByTable(table, proj_add) {
|
||||
let proj = {}
|
||||
|
||||
if (table === this.TABLES_MYGOODS) {
|
||||
proj = {
|
||||
'recGood': 1,
|
||||
'sectorGood': 1,
|
||||
'idSectorGood': 1,
|
||||
'idGood': 1,
|
||||
'idShipping': 1,
|
||||
'idStatusGood': 1,
|
||||
//**ADDFIELD_MYGOOD
|
||||
}
|
||||
|
||||
} else if (table === this.TABLES_MYGROUPS) {
|
||||
proj = {
|
||||
groupname: 1,
|
||||
title: 1,
|
||||
descr: 1,
|
||||
img: 1,
|
||||
visibility: 1,
|
||||
admins: 1,
|
||||
idCatGrp: 1,
|
||||
date_created: 1,
|
||||
date_updated: 1,
|
||||
photos: 1,
|
||||
idCity: 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
link_telegram: 1,
|
||||
comune: 1,
|
||||
mycities: 1,
|
||||
sector: 1,
|
||||
recCatGrp: 1,
|
||||
}
|
||||
} else if (table === this.TABLES_CIRCUITS) {
|
||||
proj = {
|
||||
_id: 1,
|
||||
groupnameId: 1,
|
||||
path: 1,
|
||||
name: 1,
|
||||
strProv: 1,
|
||||
subname: 1,
|
||||
longdescr: 1,
|
||||
regulation: 1,
|
||||
numMembers: 1,
|
||||
totCircolante: 1,
|
||||
totTransato: 1,
|
||||
systemUserId: 1,
|
||||
createdBy: 1,
|
||||
date_created: 1,
|
||||
date_updated: 1,
|
||||
nome_valuta: 1,
|
||||
fido_scoperto_default: 1,
|
||||
deperimento: 1,
|
||||
status: 1,
|
||||
transactionsEnabled: 1,
|
||||
qta_max_default: 1,
|
||||
fido_scoperto_default_grp: 1,
|
||||
qta_max_default_grp: 1,
|
||||
valuta_per_euro: 1,
|
||||
symbol: 1,
|
||||
idCity: 1,
|
||||
pub_to_share: 1,
|
||||
visibility: 1,
|
||||
color: 1,
|
||||
abbrev: 1,
|
||||
data_costituz: 1,
|
||||
photos: 1,
|
||||
admins: 1,
|
||||
req_users: 1,
|
||||
refused_users: 1,
|
||||
'mycities': 1,
|
||||
//**ADDFIELD_CIRCUITS
|
||||
}
|
||||
} else if (table === this.TABLES_MYSKILLS) {
|
||||
proj = {
|
||||
recSkill: 1,
|
||||
sector: 1,
|
||||
idSector: 1,
|
||||
idSkill: 1,
|
||||
myskill: 1,
|
||||
idStatusSkill: 1,
|
||||
idContribType: 1,
|
||||
numLevel: 1,
|
||||
adType: 1,
|
||||
photos: 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
//**ADDFIELD_MYSKILL
|
||||
}
|
||||
|
||||
} else if (table === this.TABLES_MYHOSPS) {
|
||||
proj = {
|
||||
visibile: 1,
|
||||
typeHosp: 1,
|
||||
numMaxPeopleHosp: 1,
|
||||
accomodation: 1,
|
||||
preferences: 1,
|
||||
idContribType: 1,
|
||||
photos: 1,
|
||||
idCity: 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
link_maplocation: 1,
|
||||
}
|
||||
|
||||
} else if (table === this.TABLES_MYBACHECAS) {
|
||||
proj = {
|
||||
recSkill: 1,
|
||||
sector: 1,
|
||||
idSector: 1,
|
||||
idSkill: 1,
|
||||
// 'idSubSkill': 1,
|
||||
idStatusSkill: 1,
|
||||
idContribType: 1,
|
||||
dateTimeStart: 1,
|
||||
dateTimeEnd: 1,
|
||||
website: 1,
|
||||
organisedBy: 1,
|
||||
contact_phone: 1,
|
||||
contact_telegram: 1,
|
||||
address: 1,
|
||||
min_partecip: 1,
|
||||
max_partecip: 1,
|
||||
contribstr: 1,
|
||||
link_maplocation: 1,
|
||||
//**ADDFIELD_MYBACHECAS
|
||||
}
|
||||
}
|
||||
|
||||
if (proj_add)
|
||||
proj = Object.assign({}, proj, proj_add);
|
||||
|
||||
return proj;
|
||||
},
|
||||
|
||||
getProjectForAll(proj_add, table) {
|
||||
let proj = {
|
||||
idContribType: 1,
|
||||
idCity: 1,
|
||||
@@ -580,6 +731,7 @@ module.exports = {
|
||||
'profile.username_telegram': 1,
|
||||
'profile.favorite': 1,
|
||||
'profile.bookmark': 1,
|
||||
'profile.attend': 1,
|
||||
'profile.seen': 1,
|
||||
reported: 1,
|
||||
date_report: 1,
|
||||
@@ -591,6 +743,11 @@ module.exports = {
|
||||
if (proj_add)
|
||||
proj = Object.assign({}, proj, proj_add);
|
||||
|
||||
if (table) {
|
||||
let proj_add3 = this.getProjectByTable(table);
|
||||
proj = Object.assign({}, proj, proj_add3);
|
||||
}
|
||||
|
||||
return proj;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user