discord-multipurpose-bot/models/Event.js

31 lines
926 B
JavaScript
Raw Normal View History

2024-10-28 23:14:58 +00:00
const mongoose = require("mongoose");
const Participant = require("./Participant");
const eventSchema = new mongoose.Schema({
name: { type: String, required: true, unique: true },
description: { type: String, required: true },
category: {
type: String,
enum: ["tournamets", "meeting", "giveaway", "other"],
default: "other",
},
location: { type: String, default: "Online" },
startDate: { type: Date, required: true },
endDate: { type: Date, required: true },
organizerId: { type: String, required: true },
participants: [{ type: mongoose.Schema.Types.ObjectId, ref: "Participant" }],
recurrence: {
type: String,
enum: ["none", "daily", "weekly", "monthly"],
default: "none",
},
status: {
type: String,
enum: ["upcoming", "completed", "cancelled"],
default: "upcoming",
},
});
module.exports = mongoose.model("Event", eventSchema);