This commit is contained in:
18
models/contests.ts
Normal file
18
models/contests.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user