- ++Booking List

- ++Delete a Booking also for the Admin.
This commit is contained in:
Paolo Arena
2019-10-12 23:34:32 +02:00
parent 624f929c56
commit cebe1208de
10 changed files with 290 additions and 17 deletions

59
server/models/sendmsg.js Normal file
View 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 };