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
|
||||
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){
|
||||
renameFile(req.body.tmpPath,req.body.finalPath,function(err){
|
||||
if (err){
|
||||
removeFile(req.body.tmpPath);
|
||||
res.status(500).json({"status":500,"message":"Could not rename the temp file"});
|
||||
} else {
|
||||
res.status(201).json({"status":201,"sermon":sermon});
|
||||
}
|
||||
});
|
||||
});
|
||||
// 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){
|
||||
// renameFile(req.body.tmpPath,req.body.finalPath,function(err){
|
||||
// if (err){
|
||||
// removeFile(req.body.tmpPath);
|
||||
// res.status(500).json({"status":500,"message":"Could not rename the temp file"});
|
||||
// } else {
|
||||
// res.status(201).json({"status":201,"sermon":sermon});
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
});
|
||||
});
|
||||
|
|
@ -158,15 +158,15 @@ router.delete("/a/",function(req,res){
|
|||
if (result.affectedRows > 0){
|
||||
/////******************************
|
||||
/////Add the sermon to the postgres db for the existing site
|
||||
var pg = require("../database/postgres-for-old-db/addSermon");
|
||||
pg.deleteSermon(result.sermon.file,function(error){
|
||||
console.log(error);
|
||||
var cPath = storage + filenameFromPath(result.sermon.file);
|
||||
var dPath = deletedStorage + filenameFromPath(result.sermon.file);
|
||||
renameFile(cPath,dPath,function(error){
|
||||
res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
||||
});
|
||||
});
|
||||
// var pg = require("../database/postgres-for-old-db/addSermon");
|
||||
// pg.deleteSermon(result.sermon.file,function(error){
|
||||
// console.log(error);
|
||||
// var cPath = storage + filenameFromPath(result.sermon.file);
|
||||
// var dPath = deletedStorage + filenameFromPath(result.sermon.file);
|
||||
// renameFile(cPath,dPath,function(error){
|
||||
// res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
||||
// });
|
||||
// });
|
||||
} else {
|
||||
res.status(200).json({"status":200,"affectedRows":result.affectedRows});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue