This commit is contained in:
Paolo Arena
2021-02-18 12:19:35 +01:00
parent 88ae9af12c
commit 14a3292da2
22 changed files with 233 additions and 122 deletions

View File

@@ -47,7 +47,7 @@ router.post('/', authenticate, (req, res) => {
.then(record => {
// tools.mylog('REC SAVED :', record.descr);
res.send({ record });
res.send({ record: record._doc });
/*
tools.sendNotificationToUser(project.userId, 'Project: ' + record.descr, record.descr, '/project/' + project.category, '', 'project', [])
@@ -96,8 +96,7 @@ router.patch('/:id', authenticate, (req, res) => {
return res.status(404).send();
}
if (project.userId !== String(req.user._id)) {
if (project.userId !== String(req.user._id) && project.privacywrite === server_constants.Privacy.onlyme) {
// I'm trying to write something not mine!
return res.status(404).send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER });
}
@@ -143,8 +142,6 @@ router.get('/calc/:id/:actualphase', authenticate, (req, res) => {
var id = req.params.id;
var actualphase = parseInt(req.params.actualphase);
let rec = {};
return Todo.calculateTreeTodo(actualphase, '', id, false, id, false)
.then((rec) => {
return res.send({ rec });
@@ -191,6 +188,7 @@ router.get('/:userId', authenticate, (req, res) => {
});
/*
// USATO SOLO LE PRIME VOLTE! O A RICHIESTA!
async function calcProjects(userId, obj) {
@@ -215,6 +213,7 @@ async function calcProjects(userId, obj) {
}
}
*/
// USATO SOLO LE PRIME VOLTE! O A RICHIESTA!
async function calcSingleProject(userId, myproj) {
@@ -226,7 +225,7 @@ async function calcSingleProject(userId, myproj) {
router.delete('/:id', authenticate, (req, res) => {
var id = req.params.id;
let hide = true;
const hide = true;
if (!ObjectID.isValid(id)) {
return res.status(404).send();