- aggiornata la grafica della Home di RISO

- Profilo Completition
- Email Verificata
- Invita un Amico (invio di email)
This commit is contained in:
Surya Paolo
2025-11-15 19:38:55 +01:00
parent 26a42b1f30
commit adf1aac10f
312 changed files with 12061 additions and 81773 deletions

114
src/models/discipline.js Executable file
View File

@@ -0,0 +1,114 @@
const mongoose = require('mongoose').set('debug', false)
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 DisciplineSchema = new Schema({
idapp: {
type: String,
},
order: {
type: Number,
},
typol_code: {
type: String,
},
label: {
type: String,
},
description: {
type: String,
},
linkpage: {
type: String,
},
color: {
type: String,
},
icon: {
type: String,
},
img_small: {
type: String,
},
img: {
type: String,
},
showinnewsletter: {
type: Boolean,
},
showinhome: {
type: Boolean,
},
teachers: [{
type: String,
}],
});
DisciplineSchema.statics.findAllIdApp = async function (idapp) {
const Discipline = this;
const query = [
{ $match: { idapp } },
{ $sort: { order: 1 } }
];
return await Discipline
.aggregate(query)
.then((arrrec) => {
return arrrec
})
};
DisciplineSchema.statics.getDisciplineforNewsletter = function (idapp) {
const Discipline = this;
const query = [
{ $match: { $and: [{ idapp }, { showinnewsletter: true }] } },
{ $sort: { order: 1 } }
];
return Discipline
.aggregate(query)
.then((arrrec) => {
return arrrec
})
};
DisciplineSchema.statics.getFieldsForSearch = function () {
return [{ field: 'label', type: tools.FieldType.string },
{ field: 'description', type: tools.FieldType.string }]
};
DisciplineSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
DisciplineSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
return await tools.DuplicateAllRecords(this, idapporig, idappdest);
};
const Discipline = mongoose.model('Discipline', DisciplineSchema);
Discipline.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Discipline };