Skip to content

Commit

Permalink
minor changes on server
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Oct 27, 2019
1 parent c46ce4f commit d32ba2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/found.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const foundSchema = mongoose.Schema({
_id : mongoose.Schema.Types.ObjectId,
label: { type: String },
email: { type: String },
timestamp: {type: Data, default: Date.now}
timestamp: {type: Date, default: Date.now}
});

module.exports = mongoose.model('Founds', foundSchema);
module.exports = mongoose.model('Founds', foundSchema);
2 changes: 2 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ router.post('/uploadlost', upload.array("lostImage", 10), (req, res, next) => {
});

router.post('/uploadfound', upload.array("foundImage", 10), (req, res, next) => {
console.log(req.body);
if(req.files.size<=0 ) {
res.status(500).json({
status: "fail"
});
} else {
const mongooseId = mongoose.Types.ObjectId();
const labelname = mongooseId;
console.log(req.body);
const newfimage = new found({
_id: mongooseId,
label: labelname,
Expand Down

0 comments on commit d32ba2b

Please sign in to comment.