insert data
This commit is contained in:
@@ -78,7 +78,30 @@ app.post('/upload/task', upload.single('file'), (req, res) => {
|
|||||||
|
|
||||||
fs.rename(oldPath, newPath, function (err) {
|
fs.rename(oldPath, newPath, function (err) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
console.log('Successfully renamed - AKA moved!')
|
console.log('Successfully renamed - AKA moved!');
|
||||||
|
console.log('Start::Database Registration!');
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
"member_uid": req.body.uid,
|
||||||
|
"job_uid": req.body.job_uid,
|
||||||
|
"filename": req.file.filename,
|
||||||
|
"originalname": req.file.originalname,
|
||||||
|
"mimetype": req.file.mimetype,
|
||||||
|
"size": req.file.size,
|
||||||
|
"encoding": req.file.encoding
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("DATA - > ", data)
|
||||||
|
var queryText = 'INSERT INTO members_jobs_files( request ) VALUES($1) RETURNING id'
|
||||||
|
db.query(queryText, [data], function(dbErr, result) {
|
||||||
|
if (dbErr) {
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log('End::Database Registration!');
|
||||||
})
|
})
|
||||||
return res.status(200).send('Completed')
|
return res.status(200).send('Completed')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user