- 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
82 lines
1.4 KiB
JavaScript
82 lines
1.4 KiB
JavaScript
const mongoose = require('mongoose');
|
|
const Schema = mongoose.Schema;
|
|
|
|
const tools = require('../tools/general');
|
|
|
|
mongoose.Promise = global.Promise;
|
|
mongoose.level = "F";
|
|
|
|
|
|
// Resolving error Unknown modifier: $pushAll
|
|
mongoose.plugin(schema => {
|
|
schema.options.usePushEach = true
|
|
});
|
|
|
|
const OperatorSchema = new Schema({
|
|
idapp: {
|
|
type: String,
|
|
},
|
|
username: {
|
|
type: String,
|
|
},
|
|
name: {
|
|
type: String,
|
|
},
|
|
surname: {
|
|
type: String,
|
|
},
|
|
email: {
|
|
type: String,
|
|
},
|
|
cell: {
|
|
type: String,
|
|
},
|
|
webpage: {
|
|
type: String,
|
|
},
|
|
img: {
|
|
type: String,
|
|
},
|
|
skype: {
|
|
type: String,
|
|
},
|
|
days_working: {
|
|
type: String,
|
|
},
|
|
facebook: {
|
|
type: String,
|
|
},
|
|
disciplines: {
|
|
type: String,
|
|
},
|
|
offers: {
|
|
type: String,
|
|
},
|
|
});
|
|
|
|
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);
|
|
};
|
|
|
|
OperatorSchema.statics.findAllIdApp = function (idapp) {
|
|
const Operator = this;
|
|
|
|
const myfind = { idapp };
|
|
|
|
return Operator.find(myfind, (err, arrrec) => {
|
|
return arrrec
|
|
});
|
|
};
|
|
|
|
const Operator = mongoose.model('Operator', OperatorSchema);
|
|
|
|
module.exports = { Operator };
|