++ aggiunta la prenotazione negli eventi. con la lista degli utenti.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
p Ciao,
|
p Ciao,
|
||||||
p Ti avvisiamo che #{username} (#{name} #{surname}) ha appena cancellato la prenotazione per l'evento #{event}:
|
p Ti avvisiamo che #{username} (#{name} #{surname}) ha appena cancellato la prenotazione per l'evento #{event}:
|
||||||
|
span #{msgbooking}
|
||||||
span #{participants}
|
span #{participants}
|
||||||
span #{participantsLunch}
|
span #{participantsLunch}
|
||||||
span #{participantsDinner}
|
span #{participantsDinner}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
p Ciao,
|
p Ciao,
|
||||||
p Ti confermiamo che #{username} (#{name} #{surname}) ha appena inviato una richiesta di prenotazione per l'evento #{event}
|
p Ti confermiamo che #{username} (#{name} #{surname}) ha appena inviato una richiesta di prenotazione per l'evento #{event}
|
||||||
|
p #{msgbooking}
|
||||||
p #{participants}
|
p #{participants}
|
||||||
p #{participantsLunch}
|
p #{participantsLunch}
|
||||||
p #{participantsDinner}
|
p #{participantsDinner}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
p Ciao,
|
p Ciao,
|
||||||
p Ti confermiamo che #{username} (#{name} #{surname}) ha appena Modificato la sua prenotazione per l'evento #{event}
|
p Ti confermiamo che #{username} (#{name} #{surname}) ha appena Modificato la sua prenotazione per l'evento #{event}
|
||||||
|
p #{msgbooking}
|
||||||
p #{participants}
|
p #{participants}
|
||||||
p #{participantsLunch}
|
p #{participantsLunch}
|
||||||
p #{participantsDinner}
|
p #{participantsDinner}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
p Ciao #{name},
|
p Ciao #{name},
|
||||||
p Ti confermiamo che la prenotazione per l'evento "#{event}" è stata cancellata.
|
p Ti confermiamo che la prenotazione per l'evento "#{event}" è stata cancellata.
|
||||||
|
p #{msgbooking}
|
||||||
p #{participants}
|
p #{participants}
|
||||||
p #{participantsLunch}
|
p #{participantsLunch}
|
||||||
p #{participantsDinner}
|
p #{participantsDinner}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
p Ciao #{name},
|
p Ciao #{name},
|
||||||
p Ti confermiamo che hai appena inviato una richiesta di prenotazione per l'evento #{event}
|
p Ti confermiamo che hai appena inviato una richiesta di prenotazione per l'evento #{event}
|
||||||
|
p #{msgbooking}
|
||||||
p #{participants}
|
p #{participants}
|
||||||
p #{participantsLunch}
|
p #{participantsLunch}
|
||||||
p #{participantsDinner}
|
p #{participantsDinner}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
p Ciao #{name},
|
p Ciao #{name},
|
||||||
p Ti confermiamo che hai modificato la prenotazione per l'evento #{event}
|
p Ti confermiamo che hai modificato la prenotazione per l'evento #{event}
|
||||||
|
p #{msgbooking}
|
||||||
p #{participants}
|
p #{participants}
|
||||||
p #{participantsLunch}
|
p #{participantsLunch}
|
||||||
p #{participantsDinner}
|
p #{participantsDinner}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"NEW_GOOD": "<strong>%s</strong> ha aggiunto un nuovo Bene: %s",
|
"NEW_GOOD": "<strong>%s</strong> ha aggiunto un nuovo Bene: %s",
|
||||||
"NEW_SERVICE": "<strong>%s</strong> ha aggiunto un nuovo Servizio: %s",
|
"NEW_SERVICE": "<strong>%s</strong> ha aggiunto un nuovo Servizio: %s",
|
||||||
"NEW_HOSP": "<strong>%s</strong> ha aggiunto una nuova Ospitalità: %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>",
|
"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> 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",
|
"<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",
|
"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",
|
"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": "%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: {
|
userId: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
username: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
tableType: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
id_bookedevent: {
|
id_bookedevent: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ const tools = require('../tools/general');
|
|||||||
const { ObjectID } = require('mongodb');
|
const { ObjectID } = require('mongodb');
|
||||||
const shared_consts = require('../tools/shared_nodejs');
|
const shared_consts = require('../tools/shared_nodejs');
|
||||||
|
|
||||||
|
const tableModel = shared_consts.TABLES_MYBACHECAS;
|
||||||
|
|
||||||
// Resolving error Unknown modifier: $pushAll
|
// Resolving error Unknown modifier: $pushAll
|
||||||
mongoose.plugin(schema => {
|
mongoose.plugin(schema => {
|
||||||
schema.options.usePushEach = true;
|
schema.options.usePushEach = true;
|
||||||
@@ -26,6 +28,7 @@ const MyBachecaSchema = new Schema({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||||
|
groupname: { type: String },
|
||||||
idSector: {
|
idSector: {
|
||||||
type: Number,
|
type: Number,
|
||||||
},
|
},
|
||||||
@@ -51,6 +54,30 @@ const MyBachecaSchema = new Schema({
|
|||||||
dateTimeEnd: {
|
dateTimeEnd: {
|
||||||
type: Date,
|
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: {
|
numLevel: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
@@ -137,7 +164,7 @@ MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
|||||||
lk_FF: '_id',
|
lk_FF: '_id',
|
||||||
lk_as: 'user',
|
lk_as: 'user',
|
||||||
af_objId_tab: 'myId',
|
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 = {
|
let myparsid = {
|
||||||
'_id': id,
|
'_id': id,
|
||||||
|
idapp,
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = [
|
let query = [
|
||||||
{
|
{
|
||||||
'$match':
|
$match:
|
||||||
myparsid,
|
myparsid,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$match': {
|
$sort: {
|
||||||
'idapp': idapp,
|
desc: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$sort': {
|
$addFields: {
|
||||||
'desc': 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'$addFields': {
|
|
||||||
'myId1': {
|
'myId1': {
|
||||||
'$toObjectId': '$userId',
|
'$toObjectId': '$userId',
|
||||||
},
|
},
|
||||||
@@ -199,7 +222,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': this.getProject(),
|
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$lookup': {
|
'$lookup': {
|
||||||
@@ -225,7 +248,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': this.getProject(),
|
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$lookup': {
|
'$lookup': {
|
||||||
@@ -251,7 +274,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': this.getProject(),
|
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||||
},
|
},
|
||||||
/*{
|
/*{
|
||||||
'$lookup': {
|
'$lookup': {
|
||||||
@@ -277,7 +300,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$project': this.getProject(),
|
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'$lookup': {
|
'$lookup': {
|
||||||
@@ -304,42 +327,26 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let numtab = tools.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
try {
|
||||||
|
let numtab = tools.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
||||||
|
|
||||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||||
query = [...query, ...objadd.query];
|
query = [...query, ...objadd.query];
|
||||||
|
|
||||||
query = query.push(
|
const toadd = {
|
||||||
{
|
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||||
$project: this.getProject(objadd.proj),
|
};
|
||||||
}
|
|
||||||
);
|
query = [...query, { ...toadd }];
|
||||||
|
} catch (e) {
|
||||||
|
console.error('e', e);
|
||||||
|
}
|
||||||
|
|
||||||
return MyBacheca.aggregate(query).then((rec) => {
|
return MyBacheca.aggregate(query).then((rec) => {
|
||||||
return rec ? rec[0] : null;
|
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) {
|
MyBachecaSchema.statics.getCompleteRecord = function (idapp, id) {
|
||||||
const MyBacheca = this;
|
const MyBacheca = this;
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
|||||||
|
|
||||||
let myparsid = {
|
let myparsid = {
|
||||||
'_id': idGood,
|
'_id': idGood,
|
||||||
|
idapp,
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = [
|
let query = [
|
||||||
@@ -157,11 +158,6 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
|||||||
'$match':
|
'$match':
|
||||||
myparsid,
|
myparsid,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'$match': {
|
|
||||||
'idapp': idapp,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'$sort': {
|
'$sort': {
|
||||||
'desc': 1,
|
'desc': 1,
|
||||||
@@ -309,11 +305,11 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
|||||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||||
query = [...query, ...objadd.query];
|
query = [...query, ...objadd.query];
|
||||||
|
|
||||||
query = [...query,
|
const toadd = {
|
||||||
{
|
$project: this.getProject(objadd.proj),
|
||||||
$project: this.getProject(objadd.proj),
|
};
|
||||||
}
|
|
||||||
];
|
query = [...query, {...toadd}];
|
||||||
|
|
||||||
return MyGood.aggregate(query).then((rec) => {
|
return MyGood.aggregate(query).then((rec) => {
|
||||||
return rec ? rec[0] : null;
|
return rec ? rec[0] : null;
|
||||||
|
|||||||
@@ -149,18 +149,13 @@ MyHospSchema.statics.executeQueryTable = function (idapp, params, user) {
|
|||||||
MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||||
const MyHosp = this;
|
const MyHosp = this;
|
||||||
|
|
||||||
const myparsid = { '_id': id };
|
const myparsid = { '_id': id, idapp };
|
||||||
|
|
||||||
let query = [
|
let query = [
|
||||||
{
|
{
|
||||||
'$match':
|
'$match':
|
||||||
myparsid,
|
myparsid,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'$match': {
|
|
||||||
'idapp': idapp,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'$sort': {
|
'$sort': {
|
||||||
'desc': 1,
|
'desc': 1,
|
||||||
@@ -307,11 +302,11 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||||
query = [...query, ...objadd.query];
|
query = [...query, ...objadd.query];
|
||||||
|
|
||||||
query = [...query,
|
const toadd = {
|
||||||
{
|
$project: this.getProject(objadd.proj),
|
||||||
$project: this.getProject(objadd.proj),
|
};
|
||||||
}
|
|
||||||
];
|
query = [...query, {...toadd}];
|
||||||
|
|
||||||
return MyHosp.aggregate(query).then((rec) => {
|
return MyHosp.aggregate(query).then((rec) => {
|
||||||
return rec ? rec[0] : null;
|
return rec ? rec[0] : null;
|
||||||
|
|||||||
@@ -156,12 +156,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
let query = [
|
let query = [
|
||||||
{
|
{
|
||||||
'$match': {
|
'$match': {
|
||||||
'_id': idSkill,
|
'_id': idSkill, idapp
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'$match': {
|
|
||||||
'idapp': idapp,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -312,11 +307,11 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||||
query = [...query, ...objadd.query];
|
query = [...query, ...objadd.query];
|
||||||
|
|
||||||
query = [...query,
|
const toadd = {
|
||||||
{
|
$project: this.getProject(objadd.proj),
|
||||||
$project: this.getProject(objadd.proj),
|
};
|
||||||
}
|
|
||||||
];
|
query = [...query, {...toadd}];
|
||||||
|
|
||||||
return MySkill.aggregate(query).then((rec) => {
|
return MySkill.aggregate(query).then((rec) => {
|
||||||
return rec ? rec[0] : null;
|
return rec ? rec[0] : null;
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ const sendmsgSchema = new Schema({
|
|||||||
},
|
},
|
||||||
source: {
|
source: {
|
||||||
page: { type: String },
|
page: { type: String },
|
||||||
event_id: { type: String }
|
event_id: { type: String },
|
||||||
|
infoevent: { type: String }
|
||||||
},
|
},
|
||||||
origin: {
|
origin: {
|
||||||
username: { type: String },
|
type: String,
|
||||||
},
|
},
|
||||||
dest: {
|
dest: {
|
||||||
idapp: { type: String, },
|
type: String,
|
||||||
username: { type: String },
|
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -54,7 +54,7 @@ sendmsgSchema.statics.findAllMsgByUsernameIdAndIdApp = function (username, lastd
|
|||||||
|
|
||||||
return SendMsg.find({
|
return SendMsg.find({
|
||||||
$and: [
|
$and: [
|
||||||
{ $or: [ { 'dest.username': username }, { 'origin.username': username },] },
|
{ $or: [ { 'dest': username }, { 'origin': username },] },
|
||||||
{ 'datemsg': {$gt: new Date(lastdataread)} },
|
{ 'datemsg': {$gt: new Date(lastdataread)} },
|
||||||
{ idapp }
|
{ idapp }
|
||||||
]
|
]
|
||||||
@@ -73,14 +73,14 @@ sendmsgSchema.statics.findLastGroupByUserIdAndIdApp = function (userId, username
|
|||||||
return SendMsg.aggregate([
|
return SendMsg.aggregate([
|
||||||
{
|
{
|
||||||
$match: {
|
$match: {
|
||||||
$or: [{ 'origin.username': username }, { 'dest.username': username }, { idapp }],
|
$or: [{ 'origin': username }, { 'dest': username }, { idapp }],
|
||||||
$and: [{ idapp }]
|
$and: [{ idapp }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$group:
|
$group:
|
||||||
{
|
{
|
||||||
_id: "$dest.username",
|
_id: "$dest",
|
||||||
message: { $last: "$message" },
|
message: { $last: "$message" },
|
||||||
datemsg: { $last: "$datemsg" },
|
datemsg: { $last: "$datemsg" },
|
||||||
dest: { $last: "$dest" },
|
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;
|
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYHOSPS, true) + myidrec;
|
||||||
tag = 'newhosp';
|
tag = 'newhosp';
|
||||||
}
|
}
|
||||||
recnotif.textaddTelegram = 'Vedi post';
|
} 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) {
|
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
|
||||||
recnotif.openUrl = '/my/' + sender;
|
recnotif.openUrl = '/my/' + sender;
|
||||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_FRIENDS_NEW_REC) {
|
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();
|
const myrecread = await SendNotif.findById(idobj).lean();
|
||||||
// console.log('myrecread._id', myrecread._id.toString());
|
// console.log('myrecread._id', myrecread._id.toString());
|
||||||
|
|
||||||
return await globalTables.sendNotif(myrecread.typedir, myrecread.typeid, res, idapp, user ? user : req.user, myrecread);
|
if (myrecread)
|
||||||
|
return await globalTables.sendNotif(myrecread.typedir, myrecread.typeid, res, idapp, user ? user : req.user, myrecread);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -666,8 +690,6 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
|
|||||||
|
|
||||||
newstatus = shared_consts.CircuitsNotif.STATUS_COINS_REFUSED_SENT;
|
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) {
|
if (newstatus) {
|
||||||
@@ -934,6 +956,13 @@ sendNotifSchema.statics.sendToTheDestinations = async function (myrecnotifpass,
|
|||||||
let send = false;
|
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 (myrecnotifpass.typedir === shared_consts.TypeNotifs.TYPEDIR_FAVORITE) {
|
||||||
if (shared_consts.TABLES_FAVORITE_BOOKMARK.includes(myrecnotifpass.tablerec)) {
|
if (shared_consts.TABLES_FAVORITE_BOOKMARK.includes(myrecnotifpass.tablerec)) {
|
||||||
if (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_FAVORITE_ADDED)) {
|
if (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_FAVORITE_ADDED)) {
|
||||||
|
|||||||
@@ -473,6 +473,14 @@ const UserSchema = new mongoose.Schema({
|
|||||||
tab: { type: Number },
|
tab: { type: Number },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
attend: [
|
||||||
|
{
|
||||||
|
_id: false,
|
||||||
|
id: { type: String },
|
||||||
|
tab: { type: Number },
|
||||||
|
num: { type: Number },
|
||||||
|
},
|
||||||
|
],
|
||||||
version: { type: Number },
|
version: { type: Number },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1614,6 +1622,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
@@ -1661,6 +1670,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
@@ -1709,6 +1719,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'comune': 1,
|
'comune': 1,
|
||||||
@@ -1934,7 +1945,7 @@ UserSchema.statics.addFavorite = async function (
|
|||||||
|
|
||||||
// Invia una Notifica al Destinatario
|
// Invia una Notifica al Destinatario
|
||||||
const recObjCreator = await globalTables.getUserCreatorByNumTabAndId(idapp, id, tab);
|
const recObjCreator = await globalTables.getUserCreatorByNumTabAndId(idapp, id, tab);
|
||||||
|
|
||||||
if (recObjCreator) {
|
if (recObjCreator) {
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: recObjCreator.username, recObjCreator, username_action: req.user.username }, false, shared_consts.TypeNotifs.TYPEDIR_FAVORITE,
|
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: recObjCreator.username, recObjCreator, username_action: req.user.username }, false, shared_consts.TypeNotifs.TYPEDIR_FAVORITE,
|
||||||
shared_consts.TypeNotifs.ID_FAVORITE_ADDED);
|
shared_consts.TypeNotifs.ID_FAVORITE_ADDED);
|
||||||
@@ -1943,6 +1954,29 @@ UserSchema.statics.addFavorite = async function (
|
|||||||
|
|
||||||
return ris;
|
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
|
// Rimuovo il Bookmark
|
||||||
UserSchema.statics.removeBookmark = async function (
|
UserSchema.statics.removeBookmark = async function (
|
||||||
idapp, username, id, tab) {
|
idapp, username, id, tab) {
|
||||||
@@ -1956,6 +1990,13 @@ UserSchema.statics.addBookmark = async function (
|
|||||||
return await User.updateOne({ idapp, username },
|
return await User.updateOne({ idapp, username },
|
||||||
{ $push: { 'profile.bookmark': { id, tab } } });
|
{ $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
|
// Aggiungo il Bookmark
|
||||||
UserSchema.statics.addSeen = async function (
|
UserSchema.statics.addSeen = async function (
|
||||||
idapp, username, id, tab) {
|
idapp, username, id, tab) {
|
||||||
@@ -2816,6 +2857,7 @@ function getWhatToShow(idapp, username) {
|
|||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2842,6 +2884,7 @@ function getWhatToShow_Unknown(idapp, username) {
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2871,6 +2914,7 @@ UserSchema.statics.getWhatToShow_IfFriends = async function (idapp, username) {
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4717,18 +4761,20 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
|
|||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
let versattualeuser = 0;
|
let versattualeuser = 0;
|
||||||
if (!recUser.profile.version) {
|
if (!recUser.profile.version) {
|
||||||
recUser.version = 0;
|
recUser.version = 0;
|
||||||
versattualeuser = 0;
|
versattualeuser = 0;
|
||||||
} else {
|
} else {
|
||||||
versattualeuser = recUser.profile.version;
|
versattualeuser = recUser.profile.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
versattualeuser = 0;
|
||||||
|
|
||||||
if (versattualeuser < version) {
|
if (versattualeuser < version) {
|
||||||
// Aggiornamento versione
|
// Aggiornamento versione
|
||||||
recUser = await User.updateVersion(versattualeuser, recUser);
|
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 } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4818,7 +4864,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
|
|||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
||||||
|
|
||||||
const { MySkill } = require('../models/myskill');
|
const { MySkill } = require('../models/myskill');
|
||||||
const { MyGood } = require('../models/mygood');
|
const { MyGood } = require('../models/mygood');
|
||||||
const { City } = require('../models/city');
|
const { City } = require('../models/city');
|
||||||
@@ -4828,27 +4874,40 @@ UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
|||||||
recUser.profile.notifs = shared_consts.DEFAULT_NOTIFS_USER;
|
recUser.profile.notifs = shared_consts.DEFAULT_NOTIFS_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
const recfavoriteNotif = recUser.profile.notifs.find((rec) => rec.dir === 11);
|
const recfavoriteNotif = recUser.profile.notifs.find((rec) => rec.dir === shared_consts.TypeNotifs.TYPEDIR_FAVORITE);
|
||||||
if (!recfavoriteNotif){
|
if (!recfavoriteNotif) {
|
||||||
recUser.profile.notifs.push( { dir: 11, value: 1 })
|
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.
|
// Imposta la provincia, se non l'ho messa, in base al bene o servizio che hai messo.
|
||||||
if (!recUser.profile.resid_province) {
|
if (!recUser.profile.resid_province) {
|
||||||
let 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) {
|
if (firstrec && firstrec.idCity && firstrec.idCity.length > 0) {
|
||||||
resid_province = await City.getProvinceByIdCity(firstrec.idCity[0]);
|
resid_province = await City.getProvinceByIdCity(firstrec.idCity[0]);
|
||||||
} else {
|
} 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) {
|
if (firstrec && firstrec.idCity && firstrec.idCity.length === 1) {
|
||||||
resid_province = await City.getProvinceByIdCity(firstrec.idCity[0]);
|
resid_province = await City.getProvinceByIdCity(firstrec.idCity[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (resid_province) {
|
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;
|
return recUser;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ router.delete('/:id/:notify/:idapp', authenticate, (req, res) => {
|
|||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
const notify = req.params.notify;
|
const notify = req.params.notify;
|
||||||
const idapp = req.params.idapp;
|
const idapp = req.params.idapp;
|
||||||
|
|
||||||
Booking.findByIdAndRemove(id).then((recbooking) => {
|
Booking.findByIdAndRemove(id).then((recbooking) => {
|
||||||
if (!recbooking) {
|
if (!recbooking) {
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const { User } = require('../models/user');
|
|||||||
const { Operator } = require('../models/operator');
|
const { Operator } = require('../models/operator');
|
||||||
const { SendMsg } = require('../models/sendmsg');
|
const { SendMsg } = require('../models/sendmsg');
|
||||||
|
|
||||||
const {SendNotif} = require('../models/sendnotif');
|
const { SendNotif } = require('../models/sendnotif');
|
||||||
|
|
||||||
const { ObjectID } = require('mongodb');
|
const { ObjectID } = require('mongodb');
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ router.post('/', authenticate, (req, res) => {
|
|||||||
User.setOnLine(req.user.idapp, req.user.username);
|
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;
|
if (check.exit) return check.ret;
|
||||||
|
|
||||||
// console.log('fieldtochange', fieldtochange);
|
// console.log('fieldtochange', fieldtochange);
|
||||||
@@ -49,26 +49,37 @@ router.post('/', authenticate, (req, res) => {
|
|||||||
|
|
||||||
return SendMsg.findById(idobj)
|
return SendMsg.findById(idobj)
|
||||||
.then(async (recmsg) => {
|
.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
|
// 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;
|
myrecsend.typedir = shared_consts.TypeNotifs.TYPEDIR_EVENTS;
|
||||||
recmsg.typeid = shared_consts.TypeNotifs.ID_EVENTS_REMOVE_REC;
|
myrecsend.typeid = shared_consts.TypeNotifs.ID_EVENTS_SEND_MSG;
|
||||||
|
myrecsend.msg = recmsg.message;
|
||||||
|
let myid = recmsg._id;
|
||||||
// ##Todo !! DA SISTEMARE !!!
|
// ##Todo !! DA SISTEMARE !!!
|
||||||
return await SendNotif.saveAndSendNotif(recmsg, req, res).then((out) => {
|
return await SendNotif.saveAndSendNotif(myrecsend, req, res).then((out) => {
|
||||||
if (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
|
else
|
||||||
return res.send({ code: server_constants.RIS_CODE_ERR, msg: '' });
|
return res.send({ code: server_constants.RIS_CODE_ERR, msg: '' });
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e.message);
|
console.error(e.message);
|
||||||
// res.status(400).send(e);
|
// 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) => {
|
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 cmd = req.body.cmd;
|
||||||
const id = req.body.id;
|
const id = req.body.id;
|
||||||
const tab = req.body.tab;
|
const tab = req.body.tab;
|
||||||
|
const num = req.body.num;
|
||||||
const value = req.body.value;
|
const value = req.body.value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const username = req.user.username;
|
const username = req.user.username;
|
||||||
|
|
||||||
let ris = null;
|
let ris = null;
|
||||||
|
let record = null;
|
||||||
|
|
||||||
if (cmd === shared_consts.CMD_USER.SET_FAVORITE) {
|
if (cmd === shared_consts.CMD_USER.SET_FAVORITE) {
|
||||||
if (tab) {
|
if (tab) {
|
||||||
@@ -1568,16 +1570,29 @@ router.post('/cmd', authenticate, async (req, res) => {
|
|||||||
else
|
else
|
||||||
ris = await User.removeBookmark(idapp, username, id, tab);
|
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 (tab) {
|
||||||
if (value)
|
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);
|
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);
|
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) {
|
} catch (e) {
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
|
|||||||
@@ -299,6 +299,7 @@ module.exports = {
|
|||||||
locale: lang,
|
locale: lang,
|
||||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||||
emailto: emailto,
|
emailto: emailto,
|
||||||
|
msgbooking: '',
|
||||||
participants: '',
|
participants: '',
|
||||||
participantsLunch: '',
|
participantsLunch: '',
|
||||||
participantsDinner: '',
|
participantsDinner: '',
|
||||||
@@ -347,6 +348,10 @@ module.exports = {
|
|||||||
|
|
||||||
msgtelegram += '\n';
|
msgtelegram += '\n';
|
||||||
|
|
||||||
|
if (recbooking.msgbooking) {
|
||||||
|
mylocalsconf.msgbooking = 'Messaggio: ' + recbooking.msgbooking.toString()
|
||||||
|
msgtelegram += mylocalsconf.msgbooking + '\n';
|
||||||
|
}
|
||||||
if (recbooking.numpeople > 0) {
|
if (recbooking.numpeople > 0) {
|
||||||
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + tools.getres__('partecipanti', res);
|
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + tools.getres__('partecipanti', res);
|
||||||
msgtelegram += mylocalsconf.participants + '\n';
|
msgtelegram += mylocalsconf.participants + '\n';
|
||||||
|
|||||||
@@ -679,7 +679,9 @@ module.exports = {
|
|||||||
return [
|
return [
|
||||||
'idapp',
|
'idapp',
|
||||||
'userId',
|
'userId',
|
||||||
|
'username',
|
||||||
'id_bookedevent',
|
'id_bookedevent',
|
||||||
|
'tableType',
|
||||||
'numpeople',
|
'numpeople',
|
||||||
'numpeopleLunch',
|
'numpeopleLunch',
|
||||||
'numpeopleDinner',
|
'numpeopleDinner',
|
||||||
@@ -1455,8 +1457,9 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
exit: true,
|
exit: true,
|
||||||
ret: res.status(404).
|
ret: false,
|
||||||
send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER }),
|
// ret: res.status(404).
|
||||||
|
// send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1836,18 +1839,33 @@ module.exports = {
|
|||||||
foreignField: params.lk_FF, // field in the 'from' collection
|
foreignField: params.lk_FF, // field in the 'from' collection
|
||||||
as: params.lk_as,
|
as: params.lk_as,
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
{
|
if (params.unwind) {
|
||||||
$replaceRoot: {
|
|
||||||
newRoot: {
|
query.push({
|
||||||
$mergeObjects: [
|
$unwind: {
|
||||||
{
|
path: '$' + params.lk_as,
|
||||||
$arrayElemAt: [
|
preserveNullAndEmptyArrays: true,
|
||||||
'$' + params.lk_as, 0],
|
}
|
||||||
}, '$$ROOT'],
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params.noarray) {
|
||||||
|
query.push(
|
||||||
|
{
|
||||||
|
$replaceRoot: {
|
||||||
|
newRoot: {
|
||||||
|
$mergeObjects: [
|
||||||
|
{
|
||||||
|
$arrayElemAt: [
|
||||||
|
'$' + params.lk_as, 0],
|
||||||
|
}, '$$ROOT'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
|
query.push(
|
||||||
{ $project: proj },
|
{ $project: proj },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -2012,21 +2030,148 @@ module.exports = {
|
|||||||
as: 'myseen',
|
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 = {
|
proj = {
|
||||||
myfav: 1,
|
myfav: 1,
|
||||||
mybook: 1,
|
mybook: 1,
|
||||||
myseen: 1,
|
myseen: 1,
|
||||||
|
myattend: 1,
|
||||||
|
mybookings: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
return { query, proj };
|
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) {
|
getQueryTable: async function (idapp, params, user) {
|
||||||
|
|
||||||
|
|
||||||
const { Search }= require('../models/search');
|
const { Search } = require('../models/search');
|
||||||
|
|
||||||
if (typeof params.startRow !== 'number') {
|
if (typeof params.startRow !== 'number') {
|
||||||
throw new Error('startRow must be number');
|
throw new Error('startRow must be number');
|
||||||
@@ -2610,7 +2755,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Save the search:
|
// Save the search:
|
||||||
if (user._id) {
|
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();
|
await mysearch.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3875,7 +4020,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateQueryStringParameter(uri, key, value) {
|
updateQueryStringParameter(uri, key, value) {
|
||||||
if (uri === '')
|
if (uri === '' || !uri)
|
||||||
return '';
|
return '';
|
||||||
var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
||||||
var separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
var separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
||||||
|
|||||||
@@ -387,9 +387,9 @@ module.exports = {
|
|||||||
let sendmsg = false;
|
let sendmsg = false;
|
||||||
|
|
||||||
if (params.typenotif === shared_consts.TypeNotifs.TYPEDIR_FAVORITE) {
|
if (params.typenotif === shared_consts.TypeNotifs.TYPEDIR_FAVORITE) {
|
||||||
if (!usernotifprofile || (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_FAVORITE_ADDED))) {
|
if (!usernotifprofile || (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_FAVORITE_ADDED))) {
|
||||||
sendmsg = true;
|
sendmsg = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sendmsg = true;
|
sendmsg = true;
|
||||||
}
|
}
|
||||||
@@ -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) {
|
getUserCreatorByNumTabAndId: async function (idapp, id, numtab) {
|
||||||
try {
|
try {
|
||||||
const table = tools.getTableByNumTab(numtab);
|
const table = tools.getTableByNumTab(numtab);
|
||||||
@@ -604,10 +648,15 @@ module.exports = {
|
|||||||
if (rec) {
|
if (rec) {
|
||||||
const recuser = await User.getUserById(idapp, rec.userId);
|
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 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)
|
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) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -138,18 +138,21 @@ module.exports = {
|
|||||||
TABLES_MYHOSPS: 'myhosps',
|
TABLES_MYHOSPS: 'myhosps',
|
||||||
TABLES_MYGOODS: 'mygoods',
|
TABLES_MYGOODS: 'mygoods',
|
||||||
TABLES_MYEVENTS: 'myevents',
|
TABLES_MYEVENTS: 'myevents',
|
||||||
|
TABLES_CIRCUITS: 'circuits',
|
||||||
|
TABLES_MYGROUPS: 'mygroups',
|
||||||
|
|
||||||
MYTABS: [{id: 0, table: 'none' },
|
MYTABS: [{ id: 0, table: 'none' },
|
||||||
{id: 1, table: 'myskills'},
|
{ id: 1, table: 'myskills' },
|
||||||
{id: 2, table: 'mybachecas' },
|
{ id: 2, table: 'mybachecas' },
|
||||||
{id: 3, table: 'myhosps'} ,
|
{ id: 3, table: 'myhosps' },
|
||||||
{id: 4, table: 'mygoods'},
|
{ id: 4, table: 'mygoods' },
|
||||||
{id: 5, table: 'myevents'}],
|
{ id: 5, table: 'myevents' }],
|
||||||
|
|
||||||
CMD_USER: {
|
CMD_USER: {
|
||||||
SET_FAVORITE: 1,
|
SET_FAVORITE: 1,
|
||||||
SET_BOOKMARK: 2,
|
SET_BOOKMARK: 2,
|
||||||
SET_SEEN: 3,
|
SET_SEEN: 3,
|
||||||
|
SET_ATTEND: 4,
|
||||||
},
|
},
|
||||||
|
|
||||||
TABLES_ENABLE_GETREC_BYID: ['mybachecas', 'myhosps', 'myskills', 'mygoods'],
|
TABLES_ENABLE_GETREC_BYID: ['mybachecas', 'myhosps', 'myskills', 'mygoods'],
|
||||||
@@ -171,13 +174,13 @@ module.exports = {
|
|||||||
TABLES_GROUPS_NOTIFICATION: ['mygroups'],
|
TABLES_GROUPS_NOTIFICATION: ['mygroups'],
|
||||||
TABLES_CIRCUITS_NOTIFICATION: ['circuits'],
|
TABLES_CIRCUITS_NOTIFICATION: ['circuits'],
|
||||||
|
|
||||||
TABLES_NUM_AS_ID_NUMBER: [ ],
|
TABLES_NUM_AS_ID_NUMBER: [],
|
||||||
|
|
||||||
TABLES_ID_STRING: [
|
TABLES_ID_STRING: [
|
||||||
'circuits',
|
'circuits',
|
||||||
'accounts',
|
'accounts',
|
||||||
'movements',
|
'movements',
|
||||||
],
|
],
|
||||||
|
|
||||||
TABLES_ID_NUMBER: [
|
TABLES_ID_NUMBER: [
|
||||||
'permissions',
|
'permissions',
|
||||||
@@ -212,19 +215,19 @@ module.exports = {
|
|||||||
table: 'adtypes',
|
table: 'adtypes',
|
||||||
key: 'descr',
|
key: 'descr',
|
||||||
},
|
},
|
||||||
{table: 'catgrps', key: 'descr'},
|
{ table: 'catgrps', key: 'descr' },
|
||||||
{
|
{
|
||||||
table: 'contribtypes',
|
table: 'contribtypes',
|
||||||
key: 'descr',
|
key: 'descr',
|
||||||
},
|
},
|
||||||
{table: 'goods', key: 'descr'},
|
{ table: 'goods', key: 'descr' },
|
||||||
{table: 'levels', key: 'descr'},
|
{ table: 'levels', key: 'descr' },
|
||||||
{table: 'cities', key: 'comune'},
|
{ table: 'cities', key: 'comune' },
|
||||||
{table: 'provinces', key: 'descr'},
|
{ table: 'provinces', key: 'descr' },
|
||||||
{table: 'sectorgoods', key: 'descr'},
|
{ table: 'sectorgoods', key: 'descr' },
|
||||||
{table: 'sectors', key: 'descr'},
|
{ table: 'sectors', key: 'descr' },
|
||||||
{table: 'skills', key: 'descr'},
|
{ table: 'skills', key: 'descr' },
|
||||||
{table: 'statusSkills', key: 'descr'},
|
{ table: 'statusSkills', key: 'descr' },
|
||||||
],
|
],
|
||||||
|
|
||||||
VISIB_ALL: 0,
|
VISIB_ALL: 0,
|
||||||
@@ -411,6 +414,8 @@ module.exports = {
|
|||||||
TYPEDIR_EVENTS: 2,
|
TYPEDIR_EVENTS: 2,
|
||||||
ID_EVENTS_NEW_REC: 1,
|
ID_EVENTS_NEW_REC: 1,
|
||||||
ID_EVENTS_REMOVE_REC: 2,
|
ID_EVENTS_REMOVE_REC: 2,
|
||||||
|
ID_EVENTS_ATTEND: 4,
|
||||||
|
ID_EVENTS_SEND_MSG: 8,
|
||||||
|
|
||||||
TYPEDIR_FRIENDS: 3,
|
TYPEDIR_FRIENDS: 3,
|
||||||
ID_FRIENDS_NEW_REC: 1,
|
ID_FRIENDS_NEW_REC: 1,
|
||||||
@@ -464,7 +469,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Tipi di Notifiche:
|
// Tipi di Notifiche:
|
||||||
/*
|
/*
|
||||||
Notif: {
|
Notif: {
|
||||||
UPDATE_APP: 1,
|
UPDATE_APP: 1,
|
||||||
@@ -520,7 +525,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'dir': 2,
|
'dir': 2,
|
||||||
'value': 1
|
'value': 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'dir': 3,
|
'dir': 3,
|
||||||
@@ -538,6 +543,10 @@ module.exports = {
|
|||||||
'dir': 11,
|
'dir': 11,
|
||||||
'value': 1
|
'value': 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'dir': 12,
|
||||||
|
'value': 1
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
CIRCUIT_STATUS: {
|
CIRCUIT_STATUS: {
|
||||||
@@ -554,7 +563,149 @@ module.exports = {
|
|||||||
SCOPERTO_MAX_CONTO_COMUNITARIO: 1000,
|
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 = {
|
let proj = {
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
@@ -580,6 +731,7 @@ module.exports = {
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
reported: 1,
|
reported: 1,
|
||||||
date_report: 1,
|
date_report: 1,
|
||||||
@@ -591,6 +743,11 @@ module.exports = {
|
|||||||
if (proj_add)
|
if (proj_add)
|
||||||
proj = Object.assign({}, proj, proj_add);
|
proj = Object.assign({}, proj, proj_add);
|
||||||
|
|
||||||
|
if (table) {
|
||||||
|
let proj_add3 = this.getProjectByTable(table);
|
||||||
|
proj = Object.assign({}, proj, proj_add3);
|
||||||
|
}
|
||||||
|
|
||||||
return proj;
|
return proj;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user