- Iscrizione Conacreis

This commit is contained in:
Paolo Arena
2021-06-04 10:07:57 +02:00
parent cf97870cc7
commit 9d5eda50ae
20 changed files with 3048 additions and 1525 deletions

View File

@@ -19,6 +19,10 @@ const IscrittiConacreisSchema = new Schema({
userId: {
type: String,
},
numTesseraInterna: {
type: Number,
default: 0,
},
name: {
type: String,
trim: true,
@@ -81,6 +85,9 @@ const IscrittiConacreisSchema = new Schema({
metodo_pagamento: {
type: Number,
},
ha_pagato: {
type: Boolean,
},
iscrizione_compilata: {
type: Boolean,
},
@@ -120,6 +127,20 @@ const IscrittiConacreisSchema = new Schema({
});
IscrittiConacreisSchema.pre('save', async function (next) {
if (this.isNew) {
const myrec = await IscrittiConacreis.findOne().limit(1).sort({ numTesseraInterna: -1 });
if (!!myrec) {
this.numTesseraInterna = myrec._doc.numTesseraInterna + 1;
} else {
this.numTesseraInterna = 0;
}
}
next();
});
var IscrittiConacreis = module.exports = mongoose.model('IscrittiConacreis', IscrittiConacreisSchema);
module.exports.getFieldsForSearch = function () {
@@ -128,6 +149,8 @@ module.exports.getFieldsForSearch = function () {
{ field: 'email', type: tools.FieldType.string }]
};
module.exports.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);

View File

@@ -70,6 +70,12 @@ const MyEventSchema = new Schema({
teacher2: {
type: String,
},
teacher3: {
type: String,
},
teacher4: {
type: String,
},
infoextra: {
type: String,
},
@@ -115,12 +121,18 @@ const MyEventSchema = new Schema({
note: {
type: String,
},
pagefooter: [{
type: String,
}],
deleted: {
type: Boolean,
},
dupId: {
type: mongoose.Schema.Types.ObjectId,
},
facebook: {
type: String,
},
modified: {
type: Boolean,
},
@@ -185,6 +197,22 @@ MyEventSchema.statics.getLastEvents = async function (idapp) {
as: 'op2'
}
},
{
$lookup: {
from: 'operators',
localField: 'teacher3',
foreignField: 'username',
as: 'op3'
}
},
{
$lookup: {
from: 'operators',
localField: 'teacher4',
foreignField: 'username',
as: 'op4'
}
},
{ "$addFields": { "contribtype": { "$toObjectId": "$contribtype" } } },
{
$lookup: {

View File

@@ -110,6 +110,9 @@ const MyPageSchema = new Schema({
l_child: {
type: Number,
},
internalpage: {
type: Boolean,
},
infooter: {
type: Boolean,
},
@@ -159,6 +162,23 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
});
};
MyPageSchema.statics.findInternalPages = async function (idapp) {
const MyPage = this;
const myfind = { idapp,
internalpage: { $exists: true, $eq: true }
};
return MyPage.find(myfind, {
title: 1,
path: 1,
onlyif_logged: 1,
only_residenti: 1,
}, (err, arrrec) => {
return arrrec
});
};
const MyPage = mongoose.model('MyPage', MyPageSchema);
module.exports = { MyPage };

View File

@@ -36,6 +36,9 @@ const orderSchema = new Schema({
price: {
type: Number
},
after_price: {
type: String
},
color: {
type: String
},

View File

@@ -45,6 +45,9 @@ const productSchema = new Schema({
price: {
type: Number
},
after_price: {
type: String
},
color: {
type: String
},
@@ -101,7 +104,7 @@ module.exports.executeQueryTable = function (idapp, params) {
};
module.exports.findAllIdApp = async function (idapp, code) {
let myfind = { idapp };
let myfind = { idapp, active: true };
if (code) {
myfind = { ...myfind, code }