This commit is contained in:
22
models/problems.ts
Normal file
22
models/problems.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {Schema, model, Types} from 'mongoose';
|
||||
|
||||
import {Session} from './sessions';
|
||||
|
||||
export interface Problem{
|
||||
_id: Types.ObjectId;
|
||||
problemId: string;
|
||||
read: Session[];
|
||||
code: Session[];
|
||||
wa: number[];
|
||||
ac: number;
|
||||
}
|
||||
|
||||
const problemSchema = new Schema<Problem>({
|
||||
problemId: {type: String, required: true},
|
||||
read: {type: [{type: Schema.Types.ObjectId, ref: 'Session'}], default: []},
|
||||
code: {type: [{type: Schema.Types.ObjectId, ref: 'Session'}], default: []},
|
||||
wa: {type: [Number], default: []},
|
||||
ac: {type: Number, default: -1},
|
||||
});
|
||||
|
||||
export const problemModel = model<Problem>('Problem', problemSchema);
|
||||
Reference in New Issue
Block a user