- Delete Event with ask confirmation
- Fix dateStart only 1 view if is the same day - Sending a message from the Event Page: to a user or to a "Event" - Add button "Ask Info" - Starting view msg into the messagepopup component
This commit is contained in:
@@ -54,6 +54,14 @@ const OperatorSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
OperatorSchema.statics.getEmailByUsername = async function (idapp, username) {
|
||||
const Operator = this;
|
||||
|
||||
return await Operator.findOne({idapp, username}, (err, arrrec) => {
|
||||
return (arrrec) ? arrrec.email : '';
|
||||
});
|
||||
};
|
||||
|
||||
OperatorSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
@@ -15,19 +15,19 @@ const sendmsgSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
userId: {
|
||||
origin: {
|
||||
userId: { type: String },
|
||||
page: { type: String },
|
||||
event_id: { type: String }
|
||||
},
|
||||
dest: {
|
||||
idapp: { type: String, },
|
||||
username: { type: String },
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
},
|
||||
idappDest: {
|
||||
type: Number,
|
||||
},
|
||||
usernameDest: {
|
||||
type: String,
|
||||
},
|
||||
msg: {
|
||||
type: String,
|
||||
},
|
||||
date: {
|
||||
datemsg: {
|
||||
type: Date,
|
||||
},
|
||||
read: {
|
||||
@@ -38,22 +38,52 @@ const sendmsgSchema = new Schema({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
originpage: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
sendmsgSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp) {
|
||||
sendmsgSchema.statics.findAllByUserIdAndIdApp = function (userId, username, idapp) {
|
||||
const SendMsg = this;
|
||||
|
||||
return SendMsg.find({userId, idapp}, (err, arrmsg) => {
|
||||
console.log('ris arrmsg:', arrmsg);
|
||||
// Filter my msg
|
||||
//
|
||||
// (userId or dest.username === username) and idapp
|
||||
|
||||
console.log('userId', userId);
|
||||
|
||||
return SendMsg.find({
|
||||
$and: [
|
||||
{
|
||||
$or: [
|
||||
{ 'origin.userId': userId },
|
||||
{ 'dest.username': username }]
|
||||
},
|
||||
{ idapp }
|
||||
]
|
||||
}, (err, arrmsg) => {
|
||||
// console.log('ris arrmsg:', arrmsg);
|
||||
return arrmsg
|
||||
});
|
||||
|
||||
// return SendMsg.find(
|
||||
// {
|
||||
// $and: [
|
||||
// {
|
||||
// $or: [
|
||||
// { 'dest.username': username },
|
||||
// { userId: userId }
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// idapp
|
||||
// }
|
||||
// ]
|
||||
// }, (err, arrmsg) => {
|
||||
// console.log('ris arrmsg:', arrmsg);
|
||||
// return arrmsg
|
||||
// });
|
||||
};
|
||||
|
||||
|
||||
var SendMsg = mongoose.model('SendMsg', sendMsgSchema);
|
||||
const SendMsg = mongoose.model('SendMsg', sendmsgSchema);
|
||||
|
||||
module.exports = { SendMsg };
|
||||
|
||||
Reference in New Issue
Block a user