Browse Source

Initial commit

master
kj1352 4 years ago
commit
7dc8d39f1b
7 changed files with 88 additions and 0 deletions
  1. +0
    -0
      .gitignore
  2. +12
    -0
      models/category.ts
  3. +8
    -0
      models/recollection-history.ts
  4. +26
    -0
      models/shelf.ts
  5. +18
    -0
      models/user.ts
  6. +3
    -0
      models/variables.ts
  7. +21
    -0
      models/word.ts

+ 0
- 0
.gitignore View File


+ 12
- 0
models/category.ts View File

@@ -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<Shelf>,
isArchived: boolean,
}

export interface MongoCategory extends Omit<Category, 'shelves'> {
shelves?: Array<string>, // Shelf IDs
}

+ 8
- 0
models/recollection-history.ts View File

@@ -0,0 +1,8 @@
export interface RecollectionHistory {
userId: string,
wordId: string,
history: Array<{
timeStamp: Date,
wasRecallSuccessful: boolean
}>
}

+ 26
- 0
models/shelf.ts View File

@@ -0,0 +1,26 @@
import { viewPermissionType } from "./variables";
import { Word } from "./word";

interface ShelfWord {
word: Word,
notes: Array<string>,
nextRevisionDateTime: Date,
spaceBetweenRecall: number, // in Days
isArchived: boolean,
}

export interface Shelf {
name: string,
description?: string,
viewType: viewPermissionType,
isArchived: boolean,
words?: Array<ShelfWord>
}

export interface MongoShelfWord extends Omit<ShelfWord, "word"> {
word: string,
}

export interface MongoShelf extends Omit<Shelf, "words"> {
words?: Array<MongoShelfWord>
}

+ 18
- 0
models/user.ts View File

@@ -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<Category>,
favouriteWords?: Array<Word>,
}

export interface MongoUser extends Omit<User, "categories" | "favouriteWords"> {
categories?: Array<string> // Category IDs,
favouriteWords?: Array<string> // Favourite Words ID
}

+ 3
- 0
models/variables.ts View File

@@ -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';

+ 21
- 0
models/word.ts View File

@@ -0,0 +1,21 @@
import { grammarType, LanguageType } from "./variables";

export interface gramaticalDetail {
type: grammarType,
description: string,
context: Array<string>,
examples: Array<string>,
}

export interface Word {
//_id is present by default in the DB
name: string,
languageType: LanguageType,
pronounciation?: {
text: string,
audio?: string,
},
similarWords?: Array<string>,
oppositeWords?: Array<string>,
grammaticalDetails: Array<gramaticalDetail>,
}

Loading…
Cancel
Save