@@ -0,0 +1,3 @@ | |||||
[submodule "src/shared"] | |||||
path = src/shared | |||||
url = git@code.webtrigon.com:kj/anamnesis-shared.git |
@@ -1,7 +1,7 @@ | |||||
import express from 'express'; | import express from 'express'; | ||||
import passport from 'passport'; | import passport from 'passport'; | ||||
import { DB_NAME, getDatabaseClient } from '../db-utils'; | import { DB_NAME, getDatabaseClient } from '../db-utils'; | ||||
import { Word } from '../models/word'; | |||||
import { Word } from '../shared/models/word'; | |||||
export const libraryRoutes = express.Router(); | export const libraryRoutes = express.Router(); | ||||
@@ -1,4 +1,4 @@ | |||||
import { gramaticalDetail, Word } from "../models/word"; | |||||
import { gramaticalDetail, Word } from "../shared/models/word"; | |||||
import { getDatabaseClient, DB_NAME, connectToDatabaseServer } from "../db-utils"; | import { getDatabaseClient, DB_NAME, connectToDatabaseServer } from "../db-utils"; | ||||
import da from '../default-library/DA.json'; | import da from '../default-library/DA.json'; | ||||
import db from '../default-library/DB.json'; | import db from '../default-library/DB.json'; | ||||
@@ -1,12 +0,0 @@ | |||||
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 | |||||
} |
@@ -1,8 +0,0 @@ | |||||
export interface RecollectionHistory { | |||||
userId: string, | |||||
wordId: string, | |||||
history: Array<{ | |||||
timeStamp: Date, | |||||
wasRecallSuccessful: boolean | |||||
}> | |||||
} |
@@ -1,26 +0,0 @@ | |||||
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> | |||||
} |
@@ -1,18 +0,0 @@ | |||||
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 | |||||
} |
@@ -1,3 +0,0 @@ | |||||
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'; |
@@ -1,21 +0,0 @@ | |||||
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>, | |||||
} |
@@ -1,11 +1,11 @@ | |||||
import express from 'express'; | import express from 'express'; | ||||
import passport from 'passport'; | import passport from 'passport'; | ||||
import { MongoShelf, MongoShelfWord } from '../models/shelf'; | |||||
import { MongoShelf, MongoShelfWord } from '../shared/models/shelf'; | |||||
import { DB_NAME, getDatabaseClient } from '../db-utils'; | import { DB_NAME, getDatabaseClient } from '../db-utils'; | ||||
import { MongoCategory } from '../models/category'; | |||||
import { MongoUser } from '../models/user'; | |||||
import { MongoCategory } from '../shared/models/category'; | |||||
import { MongoUser } from '../shared/models/user'; | |||||
import { ObjectId } from 'bson'; | import { ObjectId } from 'bson'; | ||||
import { RecollectionHistory } from '../models/recollection-history'; | |||||
import { RecollectionHistory } from '../shared/models/recollection-history'; | |||||
export const recollectionRoutes = express.Router(); | export const recollectionRoutes = express.Router(); | ||||
@@ -0,0 +1 @@ | |||||
Subproject commit 7dc8d39f1be0f5159aa473de31620a72c77b98af |
@@ -1,10 +1,10 @@ | |||||
import express from 'express'; | import express from 'express'; | ||||
import passport from 'passport'; | import passport from 'passport'; | ||||
import { MongoUser } from '../models/user'; | |||||
import { MongoUser } from '../shared/models/user'; | |||||
import { DB_NAME } from '../db-utils'; | import { DB_NAME } from '../db-utils'; | ||||
import { getDatabaseClient } from '../db-utils'; | import { getDatabaseClient } from '../db-utils'; | ||||
import { ObjectId } from 'bson'; | import { ObjectId } from 'bson'; | ||||
import { MongoCategory } from '..//models/category'; | |||||
import { MongoCategory } from '..//shared/models/category'; | |||||
export const categoryRoutes = express.Router(); | export const categoryRoutes = express.Router(); | ||||
@@ -1,9 +1,9 @@ | |||||
import express from 'express'; | import express from 'express'; | ||||
import passport from 'passport'; | import passport from 'passport'; | ||||
import { DB_NAME, getDatabaseClient } from '../db-utils'; | import { DB_NAME, getDatabaseClient } from '../db-utils'; | ||||
import { MongoUser } from '../models/user'; | |||||
import { MongoUser } from '../shared/models/user'; | |||||
import { ObjectId } from 'bson'; | import { ObjectId } from 'bson'; | ||||
import { Word } from '../models/word'; | |||||
import { Word } from '../shared/models/word'; | |||||
export const userProfileRoutes = express.Router(); | export const userProfileRoutes = express.Router(); | ||||
@@ -1,8 +1,8 @@ | |||||
import { RecollectionHistory } from '../models/recollection-history'; | |||||
import { RecollectionHistory } from '../shared/models/recollection-history'; | |||||
import express from 'express'; | import express from 'express'; | ||||
import passport from 'passport'; | import passport from 'passport'; | ||||
import { DB_NAME, getDatabaseClient } from '../db-utils'; | import { DB_NAME, getDatabaseClient } from '../db-utils'; | ||||
import { MongoUser } from '../models/user'; | |||||
import { MongoUser } from '../shared/models/user'; | |||||
export const recollectionHistoryRoutes = express.Router(); | export const recollectionHistoryRoutes = express.Router(); | ||||
@@ -1,11 +1,11 @@ | |||||
import { ObjectId } from 'bson'; | import { ObjectId } from 'bson'; | ||||
import express from 'express'; | import express from 'express'; | ||||
import passport from 'passport'; | import passport from 'passport'; | ||||
import { MongoCategory } from '../models/category'; | |||||
import { MongoCategory } from '../shared/models/category'; | |||||
import { DB_NAME } from '../db-utils'; | import { DB_NAME } from '../db-utils'; | ||||
import { getDatabaseClient } from '../db-utils'; | import { getDatabaseClient } from '../db-utils'; | ||||
import { MongoShelfWord, MongoShelf } from '../models/shelf'; | |||||
import { Word } from '../models/word'; | |||||
import { MongoShelfWord, MongoShelf } from '../shared/models/shelf'; | |||||
import { Word } from '../shared/models/word'; | |||||
export const shelfRoutes = express.Router(); | export const shelfRoutes = express.Router(); | ||||