aboutsummaryrefslogtreecommitdiff
path: root/src/server/database.ts
diff options
context:
space:
mode:
authorTyler Schicke <tschicke@gmail.com>2020-01-04 22:41:08 -0800
committerTyler Schicke <tschicke@gmail.com>2020-01-07 23:49:15 -0800
commit23d5f6b28a93a3c66c0bd7776d6a42073cc55afb (patch)
tree916d4209e7f401bb9bdc8c6d60cc333b06b23b27 /src/server/database.ts
parentda50d941f597fb3ec52bc3653d94f8c30affe552 (diff)
Added basic implementation of MemoryDatabase
Diffstat (limited to 'src/server/database.ts')
-rw-r--r--src/server/database.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/database.ts b/src/server/database.ts
index 6e0771c11..3039baedc 100644
--- a/src/server/database.ts
+++ b/src/server/database.ts
@@ -5,6 +5,7 @@ import { Utils, emptyFunction } from '../Utils';
import { DashUploadUtils } from './DashUploadUtils';
import { Credentials } from 'google-auth-library';
import { GoogleApiServerUtils } from './apis/google/GoogleApiServerUtils';
+import { IDatabase } from './IDatabase';
import * as mongoose from 'mongoose';
export namespace Database {
@@ -44,7 +45,7 @@ export namespace Database {
}
}
- class Database {
+ class Database implements IDatabase {
public static DocumentsCollection = 'documents';
private MongoClient = mongodb.MongoClient;
private currentWrites: { [id: string]: Promise<void> } = {};
@@ -215,7 +216,7 @@ export namespace Database {
if (!fetchIds.length) {
continue;
}
- const docs = await new Promise<{ [key: string]: any }[]>(res => Instance.getDocuments(fetchIds, res, "newDocuments"));
+ const docs = await new Promise<{ [key: string]: any }[]>(res => this.getDocuments(fetchIds, res, collectionName));
for (const doc of docs) {
const id = doc.id;
visited.add(id);
@@ -331,4 +332,4 @@ export namespace Database {
}
-} \ No newline at end of file
+}