Override existing predictions
This commit is contained in:
		@@ -7,10 +7,10 @@ import PredictionModel from '../models/prediction';
 | 
			
		||||
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(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);
 | 
			
		||||
		db.log(req, 'predictions', {_id: data._id}, data.toObject());
 | 
			
		||||
	});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user