- add fields: typeproj and id_main_project
This commit is contained in:
@@ -4,6 +4,8 @@ const _ = require('lodash');
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
var server_constants = require('../tools/server_constants');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
@@ -27,6 +29,12 @@ var ProjectSchema = new mongoose.Schema({
|
||||
longdescr: {
|
||||
type: String,
|
||||
},
|
||||
typeproj: {
|
||||
type: Number,
|
||||
},
|
||||
id_main_project: {
|
||||
type: String,
|
||||
},
|
||||
id_parent: {
|
||||
type: String,
|
||||
},
|
||||
@@ -97,6 +105,12 @@ var ProjectSchema = new mongoose.Schema({
|
||||
},
|
||||
endwork_estimate: {
|
||||
type: Date
|
||||
},
|
||||
privacyread: {
|
||||
type: String
|
||||
},
|
||||
privacywrite: {
|
||||
type: String
|
||||
}
|
||||
|
||||
});
|
||||
@@ -145,8 +159,11 @@ ProjectSchema.statics.findProjectByUserId = function (userId, idproj) {
|
||||
ProjectSchema.statics.findAllByUserId = function (userId) {
|
||||
var Project = this;
|
||||
|
||||
return Project.find({
|
||||
'userId': userId,
|
||||
return Project.find({ 'typeproj': server_constants.TypeProj.TYPE_PROJECT,
|
||||
$or: [
|
||||
{ 'userId': userId },
|
||||
{'privacyread' : server_constants.Privacy.all}
|
||||
]
|
||||
}).then(ris => {
|
||||
return ris
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user