const express = require('express');
const router = express.Router();
const Project = require('../lib/models/project');
const _  = require('lodash');


router.get('/:projectId/:projectName', function (req, res, next) {
    const {projectId, projectName} = req.params;
    const username = req.user.username;

    Project.findOne({where: {id: projectId, name: projectName}})
        .then(project => res.render('kanban', {
            title: `${project.name} | Tacowasa`,
            displayTitle: project.name,
            project: project,
            stages: project.stages,
            assignedStageNamesJSON: _.chain(project.stages)
                .filter({assigned: true})
                .map('name')
                .value(),
            logined: true,
            username: username
        }))
        .catch(err => next(err));
});

module.exports = router;
@@ -363,16 +363,29 @@
 ectName%7D
+, include: %5B%5D
 %7D)%0A     
@@ -403,16 +403,75 @@
 oject =%3E
+ %7B%0A            if (!project) %7B return next(); %7D%0A           
  res.ren
@@ -486,16 +486,20 @@
 ban', %7B%0A
+    
         
@@ -551,16 +551,20 @@
         
+    
 displayT
@@ -599,192 +599,61 @@
     
-project: project,%0A            stages: project.stages,%0A            assignedStageNamesJSON: _.chain(project.stages)%0A                .filter(%7Bassigned: true%7D)%0A                .map('
+    logined: true,%0A                username: user
 name
-')
 %0A   
@@ -665,79 +665,10 @@
     
-    .value(),%0A            logined: true,%0A            username: username
+%7D)
 %0A   
@@ -674,17 +674,16 @@
       %7D)
-)
 %0A       

improve performance of get project page