commit 7dc8d39f1be0f5159aa473de31620a72c77b98af Author: kj1352 Date: Thu Oct 21 16:42:50 2021 +0530 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/models/category.ts b/models/category.ts new file mode 100644 index 0000000..fb0d044 --- /dev/null +++ b/models/category.ts @@ -0,0 +1,12 @@ +import { Shelf } from "./shelf"; + +export interface Category { //_id is not needed as it is created by default + name: string, + icon: string, + shelves?: Array, + isArchived: boolean, +} + +export interface MongoCategory extends Omit { + shelves?: Array, // Shelf IDs +} \ No newline at end of file diff --git a/models/recollection-history.ts b/models/recollection-history.ts new file mode 100644 index 0000000..a695a5d --- /dev/null +++ b/models/recollection-history.ts @@ -0,0 +1,8 @@ +export interface RecollectionHistory { + userId: string, + wordId: string, + history: Array<{ + timeStamp: Date, + wasRecallSuccessful: boolean + }> +} \ No newline at end of file diff --git a/models/shelf.ts b/models/shelf.ts new file mode 100644 index 0000000..6522dcc --- /dev/null +++ b/models/shelf.ts @@ -0,0 +1,26 @@ +import { viewPermissionType } from "./variables"; +import { Word } from "./word"; + +interface ShelfWord { + word: Word, + notes: Array, + nextRevisionDateTime: Date, + spaceBetweenRecall: number, // in Days + isArchived: boolean, +} + +export interface Shelf { + name: string, + description?: string, + viewType: viewPermissionType, + isArchived: boolean, + words?: Array +} + +export interface MongoShelfWord extends Omit { + word: string, +} + +export interface MongoShelf extends Omit { + words?: Array +} diff --git a/models/user.ts b/models/user.ts new file mode 100644 index 0000000..8884e62 --- /dev/null +++ b/models/user.ts @@ -0,0 +1,18 @@ +import { Category } from "./category"; +import { Word } from "./word"; + +export interface User { + _id: string, + name: string, + email: string, + password: string, + isVerified: boolean, + otp: number, + categories?: Array, + favouriteWords?: Array, +} + +export interface MongoUser extends Omit { + categories?: Array // Category IDs, + favouriteWords?: Array // Favourite Words ID +} \ No newline at end of file diff --git a/models/variables.ts b/models/variables.ts new file mode 100644 index 0000000..6f0d24e --- /dev/null +++ b/models/variables.ts @@ -0,0 +1,3 @@ +export type grammarType = 'NOUN' | 'PRONOUN' | 'ADJECTIVE' | 'VERB' | 'ADVERB' | 'PREPOSITION' | 'CONJUNCTION' | 'INTERJECTION'; +export type viewPermissionType = 'PUBLIC' | 'PRIVATE' | 'FRIENDS' | 'FOLLOWERS'; +export type LanguageType = 'ENGLISH' | 'KANNADA' | 'HINDI' | 'TAMIL' | 'TELUGU'; diff --git a/models/word.ts b/models/word.ts new file mode 100644 index 0000000..d828e14 --- /dev/null +++ b/models/word.ts @@ -0,0 +1,21 @@ +import { grammarType, LanguageType } from "./variables"; + +export interface gramaticalDetail { + type: grammarType, + description: string, + context: Array, + examples: Array, +} + +export interface Word { + //_id is present by default in the DB + name: string, + languageType: LanguageType, + pronounciation?: { + text: string, + audio?: string, + }, + similarWords?: Array, + oppositeWords?: Array, + grammaticalDetails: Array, +} \ No newline at end of file