Skip to content

Commit

Permalink
feat(subjects): created subject schema model
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeonoi committed Sep 21, 2024
1 parent cd771e8 commit 2828578
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions models/subject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import mongoose from "mongoose";
import type { Document } from "mongoose";

export interface ISubject extends Document {
_id: string;
name: string;
lastDone: Date;
completedSessions: number;
totalSessions: number;
}

/*
* Either school subjects or OTHER which will not be a part of this category
*
* - School Subject
* - Other (anything other than a school subject)
* - All: Retains all information of all (updated all the time)
* */
export const SubjectSchema = new mongoose.Schema({
name: {
type: String,
required: true,
},

lastDone: {
type: Date,
},

completedSessions: {
type: Number,
},

totalSessions: {
type: Number,
},
});

const Subject =
mongoose.models.Task || mongoose.model<ISubject>("Subject", SubjectSchema);
export default Subject;

0 comments on commit 2828578

Please sign in to comment.