Reportistica Ore 2
This commit is contained in:
@@ -131,6 +131,9 @@ var ProjectSchema = new mongoose.Schema({
|
||||
privacywrite: {
|
||||
type: String
|
||||
},
|
||||
tipovisu: {
|
||||
type: Number,
|
||||
},
|
||||
deleted: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
@@ -178,6 +181,37 @@ ProjectSchema.statics.findProjectByUserId = function (userId, idproj) {
|
||||
}
|
||||
};
|
||||
|
||||
ProjectSchema.statics.findColorsByProject = async function (idproj) {
|
||||
const Project = this;
|
||||
|
||||
let finito = false;
|
||||
|
||||
let idparent = idproj;
|
||||
let colori = {};
|
||||
|
||||
while (!finito) {
|
||||
let rec = await Project.findOne({ '_id': idparent });
|
||||
|
||||
if (!rec)
|
||||
break;
|
||||
|
||||
if (rec) {
|
||||
colori.themebgcolor = rec.themebgcolor;
|
||||
colori.themecolor = rec.themecolor
|
||||
}
|
||||
|
||||
if (!rec.themebgcolor && !rec.themecolor) {
|
||||
// Cerca nel progetto ereditato
|
||||
idparent = rec.id_parent
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return colori;
|
||||
|
||||
};
|
||||
|
||||
|
||||
ProjectSchema.statics.findAllProjByUserId = async function (userId, idapp) {
|
||||
var Project = this;
|
||||
|
||||
Reference in New Issue
Block a user