Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {Connection} from "./connection/Connection";
|
||||
import {Inject, Singleton} from "../di";
|
||||
import {ErrorWithContext, uuid_v4} from "../util";
|
||||
import {AppClass} from "../lifecycle/AppClass";
|
||||
import {Logging} from "../service/Logging";
|
||||
import {Connection} from './connection/Connection'
|
||||
import {Inject, Singleton} from '../di'
|
||||
import {ErrorWithContext, uuid4} from '../util'
|
||||
import {AppClass} from '../lifecycle/AppClass'
|
||||
import {Logging} from '../service/Logging'
|
||||
|
||||
/**
|
||||
* A singleton, non-unit service that stores and retrieves database connections by name.
|
||||
@@ -20,20 +20,21 @@ export class DatabaseService extends AppClass {
|
||||
* @param name
|
||||
* @param connection
|
||||
*/
|
||||
register(name: string, connection: Connection) {
|
||||
register(name: string, connection: Connection): this {
|
||||
if ( this.connections[name] ) {
|
||||
this.logging.warn(`Overriding duplicate connection: ${name}`)
|
||||
}
|
||||
|
||||
this.connections[name] = connection
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a connection is registered with the given name.
|
||||
* @param name
|
||||
*/
|
||||
has(name: string) {
|
||||
return !!this.connections[name]
|
||||
has(name: string): boolean {
|
||||
return Boolean(this.connections[name])
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,10 +58,10 @@ export class DatabaseService extends AppClass {
|
||||
|
||||
/** Get a guaranteed-unique connection name. */
|
||||
uniqueName(): string {
|
||||
let name: string;
|
||||
let name: string
|
||||
|
||||
do {
|
||||
name = uuid_v4()
|
||||
name = uuid4()
|
||||
} while (this.has(name))
|
||||
|
||||
return name
|
||||
|
||||
Reference in New Issue
Block a user