- Booking Event (with email to user and admin)

- Cancel Event (with email to user and admin)
- Store into mongodb
This commit is contained in:
Paolo Arena
2019-10-05 20:01:56 +02:00
parent 507f465313
commit 8f69856c57
37 changed files with 758 additions and 46 deletions

View File

@@ -1,5 +1,7 @@
var os = require("os");
require('../config/config');
require('../models/subscribers');
var Url = require('url-parse');
@@ -67,7 +69,15 @@ module.exports = {
allfieldProject: function () {
return ['userId', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'hoursplanned', 'hoursleft', 'themecolor', 'themebgcolor', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
, 'privacyread', 'privacywrite']
, 'privacyread', 'privacywrite']
},
allfieldBooking: function () {
return ['idapp', 'userId', 'id_bookedevent', 'numpeople', 'msgbooking', 'infoevent', 'datebooked', 'booked']
},
allfieldBookingChange: function () {
return ['numpeople', 'msgbooking', 'infoevent', 'datebooked', 'booked']
},
allfieldProjectWithId: function () {
@@ -247,7 +257,55 @@ module.exports = {
// console.log('DOPO sortedList', sortedList);
return sortedList;
}
},
checkUserOk(userpassed, userauth) {
this.mylog('checkUserOk', userpassed, userauth);
if (String(userpassed) !== String(userauth)) {
// I'm trying to write something not mine!
this.mylog('userId = ', userpassed.userId, 'req.user._id', userauth);
return { exit: true, ret: res.status(404).send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER }) }
} else {
return { exit: false, ret: false }
}
},
convertHTMLtoText(myhtml) {
let msg = myhtml;
msg = msg.replace('"', '"');
msg = msg.replace('>', '>');
msg = msg.replace('&lt;', '<');
msg = msg.replace('&amp;', '&');
msg = msg.replace('<br>', '\n');
return msg
},
removeSpecialCharForEmail(myhtml) {
let msg = myhtml;
msg = msg.replace(/"/g, '\'');
return msg
},
getNomeAppByIdApp: function (idapp) {
const myapp = MYAPPS.find(item => item.idapp === idapp);
if (myapp)
return myapp.name;
else
return '';
},
getAdminEmailByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
if (myapp)
return myapp.adminemail;
else
return '';
},
};

View File

@@ -13,6 +13,34 @@ module.exports = Object.freeze({
RIS_CODE_HTTP_INVALID_TOKEN: 403,
RIS_SUBSCRIBED_OK: 1,
RIS_SUBSCRIBED_ALREADYEXIST: 2,
RIS_SUBSCRIBED_ERR: -1,
RIS_SUBSCRIBED_STR: 'subscribed',
RIS_SUBSCRIBED_MSG: {
enUs: 'Subscription to the Newsletter Confirmed!',
es: 'Suscripción al boletín confirmado!',
it: 'Sottoscrizione alla Newsletter Confermata!',
fr: 'Inscription à la newsletter confirmée!',
de: 'Anmeldung zum Newsletter bestätigt!'
} ,
RIS_SUBSCRIBED_MSG_ALREADYEXIST: {
enUs: 'Subscription already made!',
es: 'Suscripción ya realizada!',
it: 'Sottoscrizione già effettuata!',
fr: 'Abonnement déjà fait!',
de: 'Abonnement bereits gemacht!'
} ,
RIS_SUBSCRIBED_MSG_FAILED: {
enUs: 'Sign Up Failed :(',
es: 'Suscripción al boletín fallido',
it: 'Sottoscrizione alla Newsletter Fallita',
fr: 'Abonnement à la newsletter en échec',
de: 'Abonnement des fehlgeschlagenen Newsletters',
} ,
LIST_END: '10000000',
LIST_START: null,