- add fields: typeproj and id_main_project
This commit is contained in:
@@ -4,6 +4,8 @@ const _ = require('lodash');
|
|||||||
|
|
||||||
const tools = require('../tools/general');
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
var server_constants = require('../tools/server_constants');
|
||||||
|
|
||||||
mongoose.Promise = global.Promise;
|
mongoose.Promise = global.Promise;
|
||||||
mongoose.level = "F";
|
mongoose.level = "F";
|
||||||
|
|
||||||
@@ -27,6 +29,12 @@ var ProjectSchema = new mongoose.Schema({
|
|||||||
longdescr: {
|
longdescr: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
typeproj: {
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
id_main_project: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
id_parent: {
|
id_parent: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
@@ -97,6 +105,12 @@ var ProjectSchema = new mongoose.Schema({
|
|||||||
},
|
},
|
||||||
endwork_estimate: {
|
endwork_estimate: {
|
||||||
type: Date
|
type: Date
|
||||||
|
},
|
||||||
|
privacyread: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
privacywrite: {
|
||||||
|
type: String
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -145,8 +159,11 @@ ProjectSchema.statics.findProjectByUserId = function (userId, idproj) {
|
|||||||
ProjectSchema.statics.findAllByUserId = function (userId) {
|
ProjectSchema.statics.findAllByUserId = function (userId) {
|
||||||
var Project = this;
|
var Project = this;
|
||||||
|
|
||||||
return Project.find({
|
return Project.find({ 'typeproj': server_constants.TypeProj.TYPE_PROJECT,
|
||||||
'userId': userId,
|
$or: [
|
||||||
|
{ 'userId': userId },
|
||||||
|
{'privacyread' : server_constants.Privacy.all}
|
||||||
|
]
|
||||||
}).then(ris => {
|
}).then(ris => {
|
||||||
return ris
|
return ris
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ module.exports = {
|
|||||||
|
|
||||||
// #TODO Projects++ Add fields ...
|
// #TODO Projects++ Add fields ...
|
||||||
allfieldProject: function () {
|
allfieldProject: function () {
|
||||||
return ['userId', 'pos', 'id_parent', 'descr', 'longdescr', 'hoursplanned', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
|
return ['userId', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'hoursplanned', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
|
||||||
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate']
|
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
|
||||||
|
, 'privacyread', 'privacywrite']
|
||||||
},
|
},
|
||||||
|
|
||||||
allfieldProjectWithId: function () {
|
allfieldProjectWithId: function () {
|
||||||
|
|||||||
@@ -17,4 +17,16 @@ module.exports = Object.freeze({
|
|||||||
LIST_END: '10000000',
|
LIST_END: '10000000',
|
||||||
LIST_START: '0',
|
LIST_START: '0',
|
||||||
|
|
||||||
|
Privacy: {
|
||||||
|
all: 'all',
|
||||||
|
friends: 'friends',
|
||||||
|
mygroup: 'mygroup',
|
||||||
|
onlyme: 'onlyme'
|
||||||
|
},
|
||||||
|
|
||||||
|
TypeProj: {
|
||||||
|
TYPE_PROJECT: 1,
|
||||||
|
TYPE_SUBDIR: 2,
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user