Archived
2

Add prediction model

This commit is contained in:
Kai S. K. Engelbart 2021-02-03 14:45:41 +01:00
parent b189c62840
commit 67d59cedfe
2 changed files with 10 additions and 0 deletions

8
src/models/prediction.ts Normal file
View File

@ -0,0 +1,8 @@
import mongoose from 'mongoose';
const PredictionSchema = new mongoose.Schema({
values: [{ spectrumName: String, value: Number }]
});
export default mongoose.model<any, mongoose.Model<any, any>>('prediction', PredictionSchema);

View File

@ -1,6 +1,7 @@
import mongoose from 'mongoose'; import mongoose from 'mongoose';
import db from '../db'; import db from '../db';
import ModelModel from './model'; import ModelModel from './model';
import PredictionModel from './prediction';
const UserSchema = new mongoose.Schema({ const UserSchema = new mongoose.Schema({
name: {type: String, index: {unique: true}}, name: {type: String, index: {unique: true}},
@ -11,6 +12,7 @@ const UserSchema = new mongoose.Schema({
location: String, location: String,
devices: [String], devices: [String],
models: [{type: mongoose.Schema.Types.ObjectId, ref: ModelModel}], models: [{type: mongoose.Schema.Types.ObjectId, ref: ModelModel}],
predictions: [{type: mongoose.Schema.Types.ObjectId, ref: PredictionModel}],
status: String status: String
}); });