var models = require('../models');

exports.get = function (req, res){
    models.Repo.findOne({
        where: {
            repoName: req.params.account+'/'+req.params.repo,
        },
        order: [['updatedAt', 'DESC']]
    }).then(function (repo) {
        models.Commit.findAll({
            where: {
                repo: repo.repo
            }
        }).then(function (commits) {
            res.send({results: commits});
        });
    });
};
@@ -245,24 +245,48 @@
 on (repo) %7B%0A
+        if (repo) %7B%0A    
         mode
@@ -309,32 +309,36 @@
 l(%7B%0A            
+ 
+   
 where: %7B%0A       
@@ -322,32 +322,36 @@
        where: %7B%0A
+    
                 
@@ -382,10 +382,18 @@
     
+ 
-%7D%0A
+   %7D%0A    
     
@@ -437,16 +437,20 @@
         
+    
 res.send
@@ -455,24 +455,101 @@
 nd(%7B
-results: commits
+%0A                    status: 'success',%0A                    results: commits%0A                
 %7D);%0A
@@ -552,26 +552,167 @@
 %7D);%0A        
+  
+  
 %7D);%0A
+        %7D else %7B%0A            res.send(%7B%0A                status: 'error',%0A                error: 'no such repo'%0A            %7D);%0A        %7D%0A
     %7D);%0A%7D;

improve api responses