Files
vinlottis/api/schemas/PreLotteryWine.js
KevinMidboe a28a8ccacb When selecting prize, add winner to wine.
Changed the way we register a prize for winner.
Now we have a new prize_selected boolean field on a winner. This is
used to filter on when finding what winners have not selected a prize
yet. This also replaces the previous method of removing virtualWinners
after they selected a prize.

PrelotteryWine also get's a winner reference. This is used to filter on
when finding what prizes are left, and also makes it easier to
archive/register a lottery when the wine has a winner attached.
2021-02-18 20:50:30 +01:00

20 lines
392 B
JavaScript

const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const PreLotteryWine = new Schema({
name: String,
vivinoLink: String,
rating: Number,
id: String,
year: Number,
image: String,
price: String,
country: String,
winner: {
type: Schema.Types.ObjectId,
ref: "VirtualWinner"
}
});
module.exports = mongoose.model("PreLotteryWine", PreLotteryWine);