- added fields: longdescr, hoursworked, hoursplanned
This commit is contained in:
@@ -24,6 +24,18 @@ var ProjectSchema = new mongoose.Schema({
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
longdescr: {
|
||||
type: String,
|
||||
},
|
||||
hoursplanned: {
|
||||
type: Number,
|
||||
},
|
||||
hoursworked: {
|
||||
type: Number,
|
||||
},
|
||||
id_parent: {
|
||||
type: String,
|
||||
},
|
||||
priority: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -65,7 +77,7 @@ ProjectSchema.methods.toJSON = function () {
|
||||
|
||||
// console.log(projObject);
|
||||
|
||||
return _.pick(projObject, tools.allfieldTodoWithId());
|
||||
return _.pick(projObject, tools.allfieldProjectWithId());
|
||||
};
|
||||
|
||||
|
||||
@@ -78,22 +90,15 @@ ProjectSchema.statics.findByUserIdAndCat = function (userId, category) {
|
||||
});
|
||||
};
|
||||
|
||||
ProjectSchema.statics.findAllByUserIdAndCat = function (userId, category = '') {
|
||||
ProjectSchema.statics.findAllByUserId = function (userId) {
|
||||
var Project = this;
|
||||
|
||||
if (category === '') {
|
||||
return Project.find({
|
||||
'userId': userId,
|
||||
}).then(ris => {
|
||||
return tools.mapSort(ris)
|
||||
})
|
||||
return Project.find({
|
||||
'userId': userId,
|
||||
}).then(ris => {
|
||||
return ris
|
||||
})
|
||||
|
||||
} else {
|
||||
return Project.find({
|
||||
'userId': userId,
|
||||
'category': category,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ProjectSchema.statics.getArrCategoryInTable = function (userId) {
|
||||
@@ -111,7 +116,7 @@ ProjectSchema.statics.getAllProjects = async function (userId) {
|
||||
|
||||
let obj = [];
|
||||
|
||||
obj.arrproj = await Project.findAllByUserIdAndCat(userId);
|
||||
obj.arrproj = await Project.findAllByUserId(userId);
|
||||
|
||||
return obj;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user