Override existing predictions
This commit is contained in:
parent
dc662046b1
commit
f49b18d19b
@ -7,10 +7,10 @@ import PredictionModel from '../models/prediction';
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
|
|
||||||
router.post('/prediction/new', (req, res, next) => {
|
router.post('/prediction/new', async (req, res, next) => {
|
||||||
console.log("New Prediction");
|
console.log("New Prediction");
|
||||||
console.log(JSON.stringify(req.body));
|
console.log(JSON.stringify(req.body));
|
||||||
new PredictionModel(req.body).save((err, data) => {
|
await PredictionModel.findOneAndUpdate( { name: req.body.name }, { value: req.body.value }, { upsert: true, new: true }, (err, data) => {
|
||||||
if(err) return next(err);
|
if(err) return next(err);
|
||||||
db.log(req, 'predictions', {_id: data._id}, data.toObject());
|
db.log(req, 'predictions', {_id: data._id}, data.toObject());
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user