Files
ChessHub/backend/models/challenge.js
T
Moon Patel 5dbf0409f6 new API endpoint added
- DELETE /api/user/:username/challenges/:challengeID -> when user accepts or declines a challenge
2023-07-04 23:49:09 +05:30

33 lines
686 B
JavaScript

const { Schema, default: mongoose } = require("mongoose");
const { String, ObjectId, Number } = Schema.Types;
const challengeSchema = new Schema({
challenger: {
type: String,
unique: true,
required: true,
},
challenged: {
type: String,
unique: true,
required: true,
},
color: {
type: String,
enum: ["b", "w"],
required: true,
},
timeLimit: {
type: Number,
required: true,
},
roomID: {
type: String,
required: true,
unique: true,
},
});
const Challenge = mongoose.model("Challenge", challengeSchema);
module.exports = { Challenge };