discord-multipurpose-bot/models/SpyfallGame.js
2024-10-28 23:14:58 +00:00

18 lines
659 B
JavaScript

const mongoose = require("mongoose");
const { v4: uuidv4 } = require("uuid");
const gameStatusEnum = {
values: ["ongoing", "ended"],
message: 'Status must be either "ongoing" or "ended"',
};
const spyfallGameSchema = new mongoose.Schema({
gameId: { type: String, required: true, unique: true, default: uuidv4 },
guildId: { type: String, required: true },
location: { type: String, required: true },
spy: { type: String, required: true },
players: { type: [String], required: true },
status: { type: String, enum: gameStatusEnum, default: "ongoing" },
});
module.exports = mongoose.model("SpyfallGame", spyfallGameSchema);