diff options
Diffstat (limited to 'src/server/database.ts')
-rw-r--r-- | src/server/database.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/server/database.ts b/src/server/database.ts index ff8584cd7..a93117349 100644 --- a/src/server/database.ts +++ b/src/server/database.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-namespace */ import * as mongodb from 'mongodb'; import * as mongoose from 'mongoose'; import { Opt } from '../fields/Doc'; @@ -5,11 +6,11 @@ import { emptyFunction, Utils } from '../Utils'; import { GoogleApiServerUtils } from './apis/google/GoogleApiServerUtils'; import { DocumentsCollection, IDatabase } from './IDatabase'; import { MemoryDatabase } from './MemoryDatabase'; -import { Transferable } from './Message'; import { Upload } from './SharedMediaTypes'; +import { serializedDoctype } from '../fields/ObjectField'; export namespace Database { - export let disconnect: Function; + export let disconnect: () => void; class DocSchema implements mongodb.BSON.Document { _id!: string; @@ -84,6 +85,7 @@ export namespace Database { if (this.db) { const collection = this.db.collection<DocSchema>(collectionName); const prom = this.currentWrites[id]; + // eslint-disable-next-line prefer-const let newProm: Promise<void>; const run = (): Promise<void> => new Promise<void>(resolve => { @@ -112,6 +114,7 @@ export namespace Database { if (this.db) { const collection = this.db.collection<DocSchema>(collectionName); const prom = this.currentWrites[id]; + // eslint-disable-next-line prefer-const let newProm: Promise<void>; const run = (): Promise<void> => new Promise<void>(resolve => { @@ -196,6 +199,7 @@ export namespace Database { const id = value._id; const collection = this.db.collection<DocSchema>(collectionName); const prom = this.currentWrites[id]; + // eslint-disable-next-line prefer-const let newProm: Promise<void>; const run = (): Promise<void> => new Promise<void>(resolve => { @@ -219,7 +223,7 @@ export namespace Database { return undefined; } - public getDocument(id: string, fn: (result?: Transferable) => void, collectionName = DocumentsCollection) { + public getDocument(id: string, fn: (result?: serializedDoctype) => void, collectionName = DocumentsCollection) { if (this.db) { const collection = this.db.collection<DocSchema>(collectionName); collection.findOne({ _id: id }).then(resultIn => { @@ -237,7 +241,7 @@ export namespace Database { } } - public async getDocuments(ids: string[], fn: (result: Transferable[]) => void, collectionName = DocumentsCollection) { + public async getDocuments(ids: string[], fn: (result: serializedDoctype[]) => void, collectionName = DocumentsCollection) { if (this.db) { const found = await this.db .collection<DocSchema>(collectionName) |