import {Schema, model, Types} from 'mongoose'; import {Problem} from './problems'; export interface Contest{ _id: Types.ObjectId; channelId: string; startTime: number; problems: Problem[]; } const contestSchema = new Schema({ channelId: {type: String, required: true}, startTime: {type: Number, required: true}, problems: [{type: Schema.Types.ObjectId, ref: 'Problem'}], }); export const contestModel = model('Contest', contestSchema);