feat(ci): add commitizen for more consistent commit messages

This commit is contained in:
Philipp Kunz 2018-01-07 18:08:42 +01:00
parent 1af51dd989
commit cddb0caf1f

View File

@ -9,7 +9,7 @@ import { Connection as dbConnection, ConnectionOptions } from 'rethinkdb'
/** /**
* interface - indicates the connection status of the db * interface - indicates the connection status of the db
*/ */
export type TConnectionStatus = 'disconnected' | 'connected' | 'failed' export type TConnectionStatus = 'initial' | 'disconnected' | 'connected' | 'failed'
export class Db { export class Db {
dbName: string dbName: string
@ -21,6 +21,7 @@ export class Db {
constructor(connectionOptionsArg: ConnectionOptions) { constructor(connectionOptionsArg: ConnectionOptions) {
this.dbName = connectionOptionsArg.db this.dbName = connectionOptionsArg.db
this.connectionOptions = connectionOptionsArg this.connectionOptions = connectionOptionsArg
this.status = 'initial'
} }
// basic connection stuff ---------------------------------------------- // basic connection stuff ----------------------------------------------
@ -30,18 +31,17 @@ export class Db {
*/ */
async connect (): Promise<any> { async connect (): Promise<any> {
this.dbConnection = await plugins.rethinkDb.connect(this.connectionOptions) this.dbConnection = await plugins.rethinkDb.connect(this.connectionOptions)
this.status = 'connected'
plugins.beautylog.ok(`Connected to database ${this.dbName}`) plugins.beautylog.ok(`Connected to database ${this.dbName}`)
} }
/** /**
* closes the connection to the databse * closes the connection to the databse
*/ */
close (): Promise<any> { async close (): Promise<any> {
let done = plugins.smartq.defer() await this.dbConnection.close()
this.dbConnection.close() this.status = 'disconnected'
plugins.beautylog.ok(`disconnected to database ${this.dbName}`) plugins.beautylog.ok(`disconnected to database ${this.dbName}`)
done.resolve()
return done.promise
} }
// handle table to class distribution // handle table to class distribution