Add simple prediction comparison
This commit is contained in:
		@@ -2,7 +2,10 @@ import mongoose from 'mongoose';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const PredictionSchema = new mongoose.Schema({
 | 
					const PredictionSchema = new mongoose.Schema({
 | 
				
			||||||
	name: String,
 | 
						name: {
 | 
				
			||||||
 | 
							type: String,
 | 
				
			||||||
 | 
							unique: true
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
	value: Number
 | 
						value: Number
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,5 +16,11 @@ router.post('/prediction/new', (req, res, next) => {
 | 
				
			|||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					router.post('/prediction/compare', async (req, res, next) => {
 | 
				
			||||||
 | 
						const valA = (await PredictionModel.findOne({ name: req.body.nameA })).value;
 | 
				
			||||||
 | 
						const valB = (await PredictionModel.findOne({ name: req.body.nameB })).value;
 | 
				
			||||||
 | 
						res.json(valB - valA);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = router;
 | 
					module.exports = router;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user