- Fixed pagination not refreshing the data...
- Start creating single page of an Event
This commit is contained in:
@@ -29,6 +29,9 @@ const MyEventSchema = new Schema({
|
|||||||
details: {
|
details: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
bodytext: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
dateTimeStart: {
|
dateTimeStart: {
|
||||||
type: Date,
|
type: Date,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ const OperatorSchema = new Schema({
|
|||||||
type: String,
|
type: String,
|
||||||
trim: true,
|
trim: true,
|
||||||
},
|
},
|
||||||
|
usertelegram: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
cell: {
|
cell: {
|
||||||
type: String,
|
type: String,
|
||||||
trim: true,
|
trim: true,
|
||||||
@@ -74,6 +77,18 @@ OperatorSchema.statics.getFieldsForSearch = function () {
|
|||||||
return ['name', 'surname', 'email', 'cell']
|
return ['name', 'surname', 'email', 'cell']
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OperatorSchema.statics.getEmailByUsername = async function (idapp, username) {
|
||||||
|
const Operator = this;
|
||||||
|
|
||||||
|
return await Operator.findOne({ idapp, username })
|
||||||
|
.then((arrrec) => {
|
||||||
|
return ((arrrec) ? arrrec.email : '');
|
||||||
|
}).catch((e) => {
|
||||||
|
console.error('getEmailByUsername', e);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
OperatorSchema.statics.executeQueryTable = function (idapp, params) {
|
OperatorSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params);
|
||||||
|
|||||||
@@ -40,10 +40,11 @@ SettingsSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
SettingsSchema.statics.getValDbSettings = function (idapp, key) {
|
SettingsSchema.statics.getValDbSettings = function (idapp, key) {
|
||||||
return Settings.findOne({ idapp, key })
|
return Settings.findOne({ idapp, key })
|
||||||
.then((myrec) => {
|
.then((myrec) => {
|
||||||
|
console.log('getValDbSettings', myrec, 'idapp', idapp);
|
||||||
if (myrec) {
|
if (myrec) {
|
||||||
if (myrec.type === this.FieldType.date)
|
if (myrec.type === tools.FieldType.date)
|
||||||
return myrec.value_date;
|
return myrec.value_date;
|
||||||
if (myrec.type === this.FieldType.number)
|
if (myrec.type === tools.FieldType.number)
|
||||||
return myrec.value_num;
|
return myrec.value_num;
|
||||||
else
|
else
|
||||||
return myrec.value_str;
|
return myrec.value_str;
|
||||||
@@ -52,6 +53,7 @@ SettingsSchema.statics.getValDbSettings = function (idapp, key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
console.error('getValDbSettings', err);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const server_constants = require('../tools/server_constants');
|
|||||||
const { authenticate } = require('../middleware/authenticate');
|
const { authenticate } = require('../middleware/authenticate');
|
||||||
|
|
||||||
const { User } = require('../models/user');
|
const { User } = require('../models/user');
|
||||||
|
const { Operator } = require('../models/operator');
|
||||||
const { SendMsg } = require('../models/sendmsg');
|
const { SendMsg } = require('../models/sendmsg');
|
||||||
|
|
||||||
const { ObjectID } = require('mongodb');
|
const { ObjectID } = require('mongodb');
|
||||||
@@ -17,14 +18,26 @@ const shared_consts = require('../tools/shared_nodejs');
|
|||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
|
function checkifSendPushNotification() {
|
||||||
|
return process.env.ENABLE_PUSHNOTIFICATION === "1";
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function sendNotif(res, idapp, user, recmsg) {
|
async function sendNotif(res, idapp, user, recmsg) {
|
||||||
if (tools.isBitActive(recmsg.options, shared_consts.MessageOptions.Notify_ByPushNotification)) {
|
if (tools.isBitActive(recmsg.options, shared_consts.MessageOptions.Notify_ByPushNotification)) {
|
||||||
//++Todo: tools.sendNotificationToUser
|
if (this.checkifSendPushNotification) {
|
||||||
console.log('SEND PUSH NOTIFICATION ')
|
console.log('SEND PUSH NOTIFICATION ')
|
||||||
|
//++Todo: tools.sendNotificationToUser
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the Email Destination
|
// Read from the operator table first
|
||||||
const emaildest = await User.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
let emaildest = await Operator.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
||||||
|
if (emaildest === '')
|
||||||
|
emaildest = await User.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
||||||
|
|
||||||
console.log('emaildest', emaildest);
|
console.log('emaildest', emaildest);
|
||||||
|
|
||||||
// Send Msg by EMAIL
|
// Send Msg by EMAIL
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ module.exports = {
|
|||||||
surname: user.surname,
|
surname: user.surname,
|
||||||
emailto: emailto,
|
emailto: emailto,
|
||||||
participants: '',
|
participants: '',
|
||||||
msgbooking: recbooking.msgbooking,
|
msgbooking: tools.convertTexttoHtml(recbooking.msgbooking),
|
||||||
eventtextplain: tools.removeSpecialCharForEmail(recbooking.infoevent),
|
eventtextplain: tools.removeSpecialCharForEmail(recbooking.infoevent),
|
||||||
event: recbooking.infoevent,
|
event: recbooking.infoevent,
|
||||||
};
|
};
|
||||||
@@ -241,7 +241,7 @@ module.exports = {
|
|||||||
surname: user.surname,
|
surname: user.surname,
|
||||||
usernameorig: user.name + ' ' + user.surname,
|
usernameorig: user.name + ' ' + user.surname,
|
||||||
emailto: emailto,
|
emailto: emailto,
|
||||||
message: recmsg.message,
|
message: tools.convertTexttoHtml(recmsg.message),
|
||||||
infoevent: recmsg.source.infoevent,
|
infoevent: recmsg.source.infoevent,
|
||||||
strlinkreply: tools.getHostByIdApp(idapp) + '/messages/' + recmsg._id
|
strlinkreply: tools.getHostByIdApp(idapp) + '/messages/' + recmsg._id
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -314,6 +314,15 @@ module.exports = {
|
|||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
|
|
||||||
|
convertTexttoHtml(myhtml) {
|
||||||
|
// let msg = myhtml;
|
||||||
|
// msg = msg.replace('\n', '<br>');
|
||||||
|
|
||||||
|
// return msg
|
||||||
|
|
||||||
|
return myhtml;
|
||||||
|
},
|
||||||
|
|
||||||
removeSpecialCharForEmail(myhtml) {
|
removeSpecialCharForEmail(myhtml) {
|
||||||
let msg = myhtml;
|
let msg = myhtml;
|
||||||
msg = msg.replace(/"/g, '\'');
|
msg = msg.replace(/"/g, '\'');
|
||||||
|
|||||||
Reference in New Issue
Block a user