- ++Booking List
- ++Delete a Booking also for the Admin.
This commit is contained in:
59
server/models/sendmsg.js
Normal file
59
server/models/sendmsg.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const sendmsgSchema = new Schema({
|
||||
idapp: {
|
||||
type: Number,
|
||||
},
|
||||
userId: {
|
||||
type: String,
|
||||
},
|
||||
idappDest: {
|
||||
type: Number,
|
||||
},
|
||||
usernameDest: {
|
||||
type: String,
|
||||
},
|
||||
msg: {
|
||||
type: String,
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
},
|
||||
read: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
deleted: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
originpage: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
sendmsgSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp) {
|
||||
const SendMsg = this;
|
||||
|
||||
return SendMsg.find({userId, idapp}, (err, arrmsg) => {
|
||||
console.log('ris arrmsg:', arrmsg);
|
||||
return arrmsg
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var SendMsg = mongoose.model('SendMsg', sendMsgSchema);
|
||||
|
||||
module.exports = { SendMsg };
|
||||
Reference in New Issue
Block a user