Skip to content

Instantly share code, notes, and snippets.

@yehudamakarov
Last active May 3, 2019 02:05
Show Gist options
  • Save yehudamakarov/ecafe195960c85c91e54f50781c70110 to your computer and use it in GitHub Desktop.
Save yehudamakarov/ecafe195960c85c91e54f50781c70110 to your computer and use it in GitHub Desktop.
[Typescript Mongoose]
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