prediction charts

This commit is contained in:
lumijiez
2025-05-22 22:17:37 +03:00
parent 03d5f54b61
commit e2db9ed618
4 changed files with 253 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import mongoose from 'mongoose';
const predictionSchema = new mongoose.Schema({
date: {
type: Date,
required: true,
index: true
},
predictedPower: {
type: Number,
required: true
},
weatherData: {
type: Object,
required: true
},
confidence: {
type: Number,
required: true
},
lastUpdated: {
type: Date,
default: Date.now
}
});
// Create compound index for efficient querying
predictionSchema.index({ date: 1, lastUpdated: 1 });
export const Prediction = mongoose.models.Prediction || mongoose.model('Prediction', predictionSchema);