aggiunto "Seen"

This commit is contained in:
Surya Paolo
2023-04-13 14:27:00 +02:00
parent cda0bff21f
commit eea6e63c58
5 changed files with 60 additions and 0 deletions

View File

@@ -452,6 +452,13 @@ const UserSchema = new mongoose.Schema({
noFoto: {
type: Boolean,
},
seen: [
{
_id: false,
id: { type: String },
tab: { type: Number },
},
],
bookmark: [
{
_id: false,
@@ -1607,6 +1614,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
'profile.friends': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
email: 1,
date_reg: 1,
'useraport.username': 1,
@@ -1653,6 +1661,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
'profile.friends': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
email: 1,
date_reg: 1,
'useraport.username': 1,
@@ -1700,6 +1709,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
'profile.friends': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
'mycities': 1,
'comune': 1,
email: 1,
@@ -1946,6 +1956,12 @@ UserSchema.statics.addBookmark = async function (
return await User.updateOne({ idapp, username },
{ $push: { 'profile.bookmark': { id, tab } } });
};
// Aggiungo il Bookmark
UserSchema.statics.addSeen = async function (
idapp, username, id, tab) {
return await User.updateOne({ idapp, username },
{ $push: { 'profile.seen': { id, tab } } });
};
UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, usernameDest, cmd, value, disablenotif) {
@@ -2800,6 +2816,7 @@ function getWhatToShow(idapp, username) {
'profile.handshake': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
};
}
@@ -2825,6 +2842,7 @@ function getWhatToShow_Unknown(idapp, username) {
'profile.friends': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
}
}
@@ -2853,6 +2871,7 @@ UserSchema.statics.getWhatToShow_IfFriends = async function (idapp, username) {
'profile.friends': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
};
};