- added Aportador Solidario to registration

- added email_paypal and username_telegram
This commit is contained in:
Paolo Arena
2019-12-29 01:53:51 +01:00
parent 0c91e6ce0b
commit 8fd04d3b1c
3 changed files with 19 additions and 6 deletions

View File

@@ -34,9 +34,6 @@ var UserSchema = new mongoose.Schema({
message: '{VALUE} is not a valid email' message: '{VALUE} is not a valid email'
}*/ }*/
}, },
cell: {
type: String,
},
idapp: { idapp: {
type: String, type: String,
required: true, required: true,
@@ -111,6 +108,9 @@ var UserSchema = new mongoose.Schema({
news_on: { news_on: {
type: Boolean type: Boolean
}, },
aportador_solidario: {
type: String,
},
profile: { profile: {
img: { img: {
type: String type: String
@@ -118,6 +118,12 @@ var UserSchema = new mongoose.Schema({
cell: { cell: {
type: String type: String
}, },
email_paypal: {
type: String
},
username_telegram: {
type: String
},
dateofbirth: { dateofbirth: {
type: Date, type: Date,
}, },
@@ -376,7 +382,7 @@ UserSchema.statics.getUsersListByParams = function (params) {
*/ */
UserSchema.statics.getFieldsForSearch = function () { UserSchema.statics.getFieldsForSearch = function () {
return ['name', 'surname', 'email', 'cell'] return ['name', 'surname', 'email', 'profile.cell', 'profile.email_paypal', 'profile.username_telegram', 'aportador_solidario']
}; };
UserSchema.statics.executeQueryTable = function (idapp, params) { UserSchema.statics.executeQueryTable = function (idapp, params) {

View File

@@ -246,7 +246,8 @@ router.patch('/chval', authenticate, (req, res) => {
tools.mylogshow('PATCH CHVAL: ', id, fieldsvalue); tools.mylogshow('PATCH CHVAL: ', id, fieldsvalue);
if (!User.isAdmin(req.user) && !User.isManager(req.user)) { // If I change my record...
if ((!User.isAdmin(req.user) && !User.isManager(req.user)) || (req.user._id === id)) {
// If without permissions, exit // If without permissions, exit
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' }); return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
} }
@@ -388,6 +389,11 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
return Promise.all([bookedevent, eventlist, operators, wheres, contribtype, settings, permissions, disciplines, newstosent, mailinglist, mypage, gallery]) return Promise.all([bookedevent, eventlist, operators, wheres, contribtype, settings, permissions, disciplines, newstosent, mailinglist, mypage, gallery])
.then((arrdata) => { .then((arrdata) => {
// console.table(arrdata); // console.table(arrdata);
const myuser = req.user;
if (myuser) {
myuser.password = '';
}
res.send({ res.send({
bookedevent: arrdata[0], bookedevent: arrdata[0],
eventlist: arrdata[1], eventlist: arrdata[1],
@@ -401,6 +407,7 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
mailinglist: arrdata[9], mailinglist: arrdata[9],
mypage: arrdata[10], mypage: arrdata[10],
gallery: arrdata[11], gallery: arrdata[11],
myuser,
}); });
}) })
.catch((e) => { .catch((e) => {

View File

@@ -12,7 +12,7 @@ module.exports = {
}, },
fieldsUserToChange() { fieldsUserToChange() {
return ['_id', 'username', 'email', 'cell', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on'] return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'news_on', 'aportador_solidario']
} }
}; };