diff --git a/config.json b/config.json new file mode 100644 index 0000000..3a4c2cc --- /dev/null +++ b/config.json @@ -0,0 +1,4 @@ +{ + "email": "mranjan1398@gmail.com", + "password" : "MrZm1310" +} \ No newline at end of file diff --git a/models/found.js b/models/found.js index 80790fb..1b117d2 100644 --- a/models/found.js +++ b/models/found.js @@ -3,7 +3,8 @@ const mongoose = require('mongoose'); const foundSchema = mongoose.Schema({ _id : mongoose.Schema.Types.ObjectId, label: { type: String }, - email: { type: String } + email: { type: String }, + timestamp: {type: Data, default: Date.now} }); module.exports = mongoose.model('Founds', foundSchema); \ No newline at end of file diff --git a/models/losts.js b/models/losts.js index 8c857e4..fea1c29 100644 --- a/models/losts.js +++ b/models/losts.js @@ -4,7 +4,8 @@ const lostSchema = mongoose.Schema({ _id : mongoose.Schema.Types.ObjectId, label: { type: String }, isEncoding: {type: Boolean, default: false}, - email: {type: String} + email: {type: String}, + timestamp: {type: Date, default: Date.now} }); module.exports = mongoose.model('Losts', lostSchema); diff --git a/routes/index.js b/routes/index.js index 675622f..8e23678 100644 --- a/routes/index.js +++ b/routes/index.js @@ -9,6 +9,7 @@ const spawn = require('child_process').spawn; const lost = require('./../models/losts.js'); const found = require('./../models/found.js'); const nodemailer = require('nodemailer'); +const config = require("./../config.json"); const storage = multer.diskStorage({ destination: function (req, file, cb) { @@ -134,24 +135,8 @@ router.post('/uploadfound', upload.array("lostImage", 10), (req, res, next) => { console.log(`${__dirname}/../uploads/found/${labelname}/0.jpg`) const pythonProcess = spawn('python3', [`${__dirname}/../scripts/Central_FR.py`, `${__dirname}/../uploads/found/${labelname}/0.jpg`]); - var id, similarity; pythonProcess.stdout.on('data', (data) => { - // console.log(data.toString('utf8')); - var temp = data.toString('utf8'); - if(temp.length > 5) id = temp; - else { - similarity = temp; - console.log(id, similarity); - // var transporter = nodemailer.createTransport({ - // service: 'gmail', - // auth: { - // user: config.email.username, - // pass: config.email.password - // }, - // secure: true, - // pool: true - // }); - } + console.log(data.toString('utf8')); }); newfimage