Schemas I think

This commit is contained in:
Kasper Rynning-Tønnesen
2020-01-17 13:36:06 +01:00
parent 6ce917f5d5
commit cdbd2accd0
4 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const Highscore = new Schema({
name: String,
Wins: [
{
color: String,
date: Date,
wine: {
type: Schema.Types.ObjectId,
ref: "Wine"
}
}
]
});
module.exports = Highscore;

View File

@@ -0,0 +1,12 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const Purchase = new Schema({
date: Date,
blue: Number,
red: Number,
yellow: Number,
green: Number
});
module.exports = Purchase;

View File

@@ -0,0 +1,9 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const passportLocalMongoose = require("passport-local-mongoose");
const User = new Schema({});
User.plugin(passportLocalMongoose);
module.exports = mongoose.model("User", User);

View File

@@ -0,0 +1,10 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const Wine = new Schema({
name: String,
vivinoLink: String,
rating: Number
});
module.exports = Wine;