Files
freeplanet_serverside/server/models/myevent.js
Paolo Arena 1a1348c563 - Load Events
- Edit Events
- When a field is updated: undate also memory list record

- Duplicate Event
2019-10-20 22:45:09 +02:00

125 lines
1.8 KiB
JavaScript

const mongoose = require('mongoose');
const Schema = mongoose.Schema;
mongoose.Promise = global.Promise;
mongoose.level = "F";
const tools = require('../tools/general');
const { ObjectID } = require('mongodb');
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const MyEventSchema = new Schema({
idapp: {
type: String,
},
typol: {
type: String,
},
short_tit: {
type: String,
},
title: {
type: String,
},
details: {
type: String,
},
withtime: {
type: Boolean,
},
dur: {
type: Number,
},
dur2: {
type: Number,
},
days: {
type: Number,
},
date: {
type: Date,
},
bgcolor: {
type: String,
},
icon: {
type: String,
},
img_small: {
type: String,
},
img: {
type: String,
},
where: {
type: String,
},
contribtype: { // TABLE
type: Number,
},
price: {
type: Number,
},
infoafterprice: {
type: String,
},
teacher: { // TABLE ?!
type: String,
},
teacher2: {
type: String,
},
infoextra: {
type: String,
},
linkpage: {
type: String,
},
linkpdf: {
type: String,
},
nobookable: {
type: Boolean,
},
news: {
type: Boolean,
},
canceled: {
type: Boolean,
},
deleted: {
type: Boolean,
},
dupId: {
type: mongoose.Schema.Types.ObjectId,
},
modified: {
type: Boolean,
},
});
MyEventSchema.statics.findAllIdApp = function (idapp) {
const Event = this;
const myfind = { idapp };
return Event.find(myfind, (err, arrrec) => {
return arrrec
});
};
MyEventSchema.statics.executeQueryTable = function (idapp, params) {
return tools.executeQueryTable(this, idapp, params);
};
const MyEvent = mongoose.model('MyEvent', MyEventSchema);
module.exports = { MyEvent };