Last active
May 3, 2019 02:05
-
-
Save yehudamakarov/ecafe195960c85c91e54f50781c70110 to your computer and use it in GitHub Desktop.
[Typescript Mongoose]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongoose, { Document, Model } from "mongoose"; | |
import { IRashiDocument, IRashiObject, RashiSchema } from "./Rashi"; | |
export interface IChumashObject { | |
learnOnDate: Date; | |
dayOfTheWeek: string; | |
hebrewPesukim: Pesukim; | |
englishPesukim: Pesukim; | |
amountOfPesukim: number | null; | |
rashiDocument: IRashiObject; | |
aliyah: number; | |
mmddyyyy: string; | |
parshaNameEnglish: string; | |
} | |
interface IPasukObject { | |
pasukNumber: string; | |
pasukWords: string; | |
} | |
export type Pesukim = IPasukObject[]; | |
export interface IChumashDocument extends Document { | |
learnOnDate: Date; | |
dayOfTheWeek: string; | |
hebrewPesukim: Array<{ | |
pasukNumber: string; | |
pasukWords: string; | |
}>; | |
englishPesukim: Array<{ | |
pasukNumber: string; | |
pasukWords: string; | |
}>; | |
amountOfPesukim: number; | |
rashiDocument: IRashiDocument; | |
aliyah: number; | |
mmddyyyy: string; | |
parshaNameEnglish: string; | |
} | |
export const ChumashSchema = new mongoose.Schema({ | |
aliyah: Number, | |
amountOfPesukim: Number, | |
dayOfTheWeek: String, | |
englishPesukim: [{ | |
pasukNumber: String, | |
pasukWords: String, | |
}], | |
hebrewPesukim: [{ | |
pasukNumber: String, | |
pasukWords: String, | |
}], | |
learnOnDate: Date, | |
mmddyyyy: String, | |
parshaNameEnglish: String, | |
rashiDocument: RashiSchema, | |
}); | |
export const ChumashModel: Model<IChumashDocument> = mongoose.model<IChumashDocument>("Chumash", ChumashSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment