aggiornato prodotti e scontistica

This commit is contained in:
Surya Paolo
2023-12-29 15:19:15 +01:00
parent 3d1dddba39
commit 633b9a2d8c
7 changed files with 117 additions and 34 deletions

View File

@@ -287,6 +287,9 @@ const UserSchema = new mongoose.Schema({
manage_telegram: {
type: Boolean,
},
admin_telegram: {
type: Boolean,
},
resplist: {
type: Boolean,
},
@@ -3606,7 +3609,7 @@ UserSchema.statics.getusersAdmin = async function (idapp) {
// Int32 mongodb 6.0
return await User.find({ idapp, 'profile.manage_telegram': true, perm: { $bitsAnySet: 0b001 } },
return await User.find({ idapp, 'profile.admin_telegram': true, perm: { $bitsAnySet: 0b001 } },
{ username: 1, 'profile.teleg_id': 1, perm: 1 }).then((arrrec) => {
return (!!arrrec) ? arrrec : null;
}).catch((e) => {
@@ -3707,7 +3710,7 @@ UserSchema.statics.isAdminByIdTeleg = async function (idapp, idtelegram) {
return await User.findOne({
idapp,
username: 'paoloar77',
'profile.manage_telegram': true,
'profile.admin_telegram': true,
'profile.teleg_id': idtelegram,
}, { 'profile.teleg_id': 1 }).then((rec) => {
return (!!rec && rec.profile.teleg_id === idtelegram);
@@ -5407,6 +5410,7 @@ UserSchema.statics.addNewSite = async function (idappPass, body) {
myuser.profile.special_req = true;
myuser.profile.nationality = 'IT';
myuser.profile.manage_telegram = true;
myuser.profile.admin_telegram = true;
myuser.profile.teleg_id = MyTelegramBot.ADMIN_IDTELEGRAM_SERVER;
myuser.profile.username_telegram = MyTelegramBot.ADMIN_USERNAME_TELEGRAM;
myuser.lasttimeonline = new Date();