19 lines
472 B
TypeScript
19 lines
472 B
TypeScript
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<Contest>({
|
|
channelId: {type: String, required: true},
|
|
startTime: {type: Number, required: true},
|
|
problems: [{type: Schema.Types.ObjectId, ref: 'Problem'}],
|
|
});
|
|
|
|
export const contestModel = model<Contest>('Contest', contestSchema);
|