Privacy about Project: what to see, what you can modify...
This commit is contained in:
@@ -9,6 +9,8 @@ var server_constants = require('../tools/server_constants');
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
@@ -144,7 +146,7 @@ ProjectSchema.statics.findProjectByUserId = function (userId, idproj) {
|
||||
} else {
|
||||
return Project.findOne({
|
||||
'userId': userId,
|
||||
'_id': idproj,
|
||||
'_id': ObjectId(idproj),
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -175,7 +177,7 @@ ProjectSchema.statics.findAllProjByUserId = async function (userId) {
|
||||
// }
|
||||
]).then(ris1 => {
|
||||
|
||||
console.log('findAllProjByUserId', ris1);
|
||||
// console.log('findAllProjByUserId', ris1);
|
||||
|
||||
return ris1;
|
||||
})
|
||||
@@ -205,7 +207,7 @@ ProjectSchema.statics.getIdParentByIdProj = function (idProj) {
|
||||
|
||||
console.log('INIT getIdParentByIdProj', idProj);
|
||||
|
||||
return Project.findOne({ '_id': idProj }).then(rec => {
|
||||
return Project.findOne({ '_id': ObjectId(idProj) }).then(rec => {
|
||||
if (!!rec) {
|
||||
console.log('getIdParentByIdProj', rec.id_parent);
|
||||
return rec.id_parent;
|
||||
@@ -220,13 +222,13 @@ ProjectSchema.statics.getIdParentByIdProj = function (idProj) {
|
||||
|
||||
ProjectSchema.statics.getAllProjects = async function (userId) {
|
||||
var Project = this;
|
||||
console.log('getAllProjects');
|
||||
// console.log('getAllProjects');
|
||||
|
||||
let obj = [];
|
||||
|
||||
const projbase = await Project.findById(process.env.PROJECT_ID_MAIN)
|
||||
.then(ris => {
|
||||
console.log('ris', ris);
|
||||
// console.log('ris', ris);
|
||||
if (!!ris._doc)
|
||||
return ris._doc;
|
||||
else
|
||||
@@ -242,7 +244,6 @@ ProjectSchema.statics.getAllProjects = async function (userId) {
|
||||
|
||||
ProjectSchema.statics.enabletoModify = async function (userId, idProj) {
|
||||
var Project = this;
|
||||
console.log('getAllProjects');
|
||||
|
||||
let obj = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user