Remove code for updating postgres database
parent
7687af19de
commit
8b5b19ac08
|
|
@ -111,17 +111,17 @@ router.post("/a/", function(req,res){
|
||||||
}
|
}
|
||||||
/////******************************
|
/////******************************
|
||||||
/////Add the sermon to the postgres db for the existing site
|
/////Add the sermon to the postgres db for the existing site
|
||||||
var pg = require("../database/postgres-for-old-db/addSermon");
|
// var pg = require("../database/postgres-for-old-db/addSermon");
|
||||||
pg.addSermon(new Date(),req.body.title,req.body.author,req.body.description,req.body.file,function(error){
|
// pg.addSermon(new Date(),req.body.title,req.body.author,req.body.description,req.body.file,function(error){
|
||||||
renameFile(req.body.tmpPath,req.body.finalPath,function(err){
|
// renameFile(req.body.tmpPath,req.body.finalPath,function(err){
|
||||||
if (err){
|
// if (err){
|
||||||
removeFile(req.body.tmpPath);
|
// removeFile(req.body.tmpPath);
|
||||||
res.status(500).json({"status":500,"message":"Could not rename the temp file"});
|
// res.status(500).json({"status":500,"message":"Could not rename the temp file"});
|
||||||
} else {
|
// } else {
|
||||||
res.status(201).json({"status":201,"sermon":sermon});
|
// res.status(201).json({"status":201,"sermon":sermon});
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -158,15 +158,15 @@ router.delete("/a/",function(req,res){
|
||||||
if (result.affectedRows > 0){
|
if (result.affectedRows > 0){
|
||||||
/////******************************
|
/////******************************
|
||||||
/////Add the sermon to the postgres db for the existing site
|
/////Add the sermon to the postgres db for the existing site
|
||||||
var pg = require("../database/postgres-for-old-db/addSermon");
|
// var pg = require("../database/postgres-for-old-db/addSermon");
|
||||||
pg.deleteSermon(result.sermon.file,function(error){
|
// pg.deleteSermon(result.sermon.file,function(error){
|
||||||
console.log(error);
|
// console.log(error);
|
||||||
var cPath = storage + filenameFromPath(result.sermon.file);
|
// var cPath = storage + filenameFromPath(result.sermon.file);
|
||||||
var dPath = deletedStorage + filenameFromPath(result.sermon.file);
|
// var dPath = deletedStorage + filenameFromPath(result.sermon.file);
|
||||||
renameFile(cPath,dPath,function(error){
|
// renameFile(cPath,dPath,function(error){
|
||||||
res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
// res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
} else {
|
} else {
|
||||||
res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue