Cut/Paste project and todos
This commit is contained in:
@@ -113,9 +113,24 @@ router.patch('/:id', authenticate, (req, res) => {
|
||||
});
|
||||
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
tools.mylog('GET ALL PROJECTS: ');
|
||||
|
||||
return Project.getAllProjects('').then((objprojects) => {
|
||||
if (!!objprojects.arrproj)
|
||||
tools.mylog('projects', objprojects.arrproj.length);
|
||||
|
||||
return objprojects
|
||||
}).then((objprojects) => {
|
||||
res.send({ projects: objprojects.arrproj });
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
res.status(400).send(e);
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/:userId', authenticate, (req, res) => {
|
||||
var userId = req.params.userId;
|
||||
// var category = req.params.category;
|
||||
const userId = req.params.userId;
|
||||
|
||||
tools.mylog('GET PROJECTS : ', req.params);
|
||||
|
||||
@@ -129,25 +144,16 @@ router.get('/:userId', authenticate, (req, res) => {
|
||||
}
|
||||
|
||||
// Extract all the projects of the userId only
|
||||
// Project.findAllByUserIdAndCat(userId, category).then((projects) => {
|
||||
return Project.getAllProjects(userId).then((objprojects) => {
|
||||
if (!!objprojects.arrproj)
|
||||
tools.mylog('projects', objprojects.arrproj.length);
|
||||
|
||||
// console.log(objprojects.arrproj);
|
||||
|
||||
return objprojects
|
||||
|
||||
}).then((objprojects) => {
|
||||
// tools.mylog('objprojects', objprojects);
|
||||
|
||||
// if (tools.EXECUTE_CALCPROJ) {
|
||||
// return calcProjects('', objprojects).then(objout => {
|
||||
// res.send({ projects: objprojects.arrproj });
|
||||
// });
|
||||
// } else {
|
||||
res.send({ projects: objprojects.arrproj });
|
||||
// }
|
||||
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
res.status(400).send(e);
|
||||
@@ -155,6 +161,8 @@ router.get('/:userId', authenticate, (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// USATO SOLO LE PRIME VOLTE! O A RICHIESTA!
|
||||
async function calcProjects(userId, obj) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user