From e613ace2fffc2037fa49570669041a6f4a17325c Mon Sep 17 00:00:00 2001 From: Roman Vaivod Date: Wed, 29 Apr 2020 14:24:15 +0200 Subject: [PATCH] gh-133: Surround | with spaces --- backend/bot/bot-factory.ts | 2 +- backend/repositories/MatchRepository.ts | 2 +- backend/storage/Storage.ts | 4 ++-- backend/storage/StorageContext.test.ts | 4 ++-- backend/storage/StorageContext.ts | 6 +++--- backend/storage/db/db-transactions.ts | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/bot/bot-factory.ts b/backend/bot/bot-factory.ts index c660ac51..c9e1ebb0 100644 --- a/backend/bot/bot-factory.ts +++ b/backend/bot/bot-factory.ts @@ -18,7 +18,7 @@ export class SingleChannelBot { } export const makeBot = -(botToken: string|undefined, channelName: string|undefined): Promise => { +(botToken: string | undefined, channelName: string | undefined): Promise => { return new Promise((resolve, reject): void => { if (!botToken || !channelName) { reject(Error('botToken or channelName missing')) diff --git a/backend/repositories/MatchRepository.ts b/backend/repositories/MatchRepository.ts index c6f279bc..e9fe6aad 100644 --- a/backend/repositories/MatchRepository.ts +++ b/backend/repositories/MatchRepository.ts @@ -49,7 +49,7 @@ Promise => { ) } -const getElapsedSecondsSinceLatestMatch = async (gameId: number): Promise => { +const getElapsedSecondsSinceLatestMatch = async (gameId: number): Promise => { const latestMatch = await storage.getLatestMatchByGameId(gameId) if (latestMatch == null) { return null diff --git a/backend/storage/Storage.ts b/backend/storage/Storage.ts index 474ee08a..6e62de81 100644 --- a/backend/storage/Storage.ts +++ b/backend/storage/Storage.ts @@ -52,7 +52,7 @@ export const getAllMatches = async (): Promise> => { return executeAndCommit(context => context.getAllMatches()) } -export const getLatestMatchByGameId = async (gameId: number): Promise => { +export const getLatestMatchByGameId = async (gameId: number): Promise => { return executeAndCommit(context => context.getLatestMatchByGameId(gameId)) } @@ -64,7 +64,7 @@ export const getGameByName = async (name: string): Promise => { return executeAndCommit(context => context.getGameByName(name)) } -export const insertGame = async (game: GameData): Promise => { +export const insertGame = async (game: GameData): Promise => { return executeAndCommit(context => context.insertGame(game)) } diff --git a/backend/storage/StorageContext.test.ts b/backend/storage/StorageContext.test.ts index 6e8099e0..dc14bbaf 100644 --- a/backend/storage/StorageContext.test.ts +++ b/backend/storage/StorageContext.test.ts @@ -46,7 +46,7 @@ describe('StorageContext', () => { [ 'null', 'null', null, null ], [ 'foosball row', 'foosball game', FOOSBALL_ROW, FOOSBALL_GAME ], ])('when executeSingleResultQuery resolves with %s', (res1Desc, res2Desc, row, result) => { - let foosballGame: Game|null + let foosballGame: Game | null beforeEach(async () => { TRANSACTION_MOCK.executeSingleResultQuery.mockResolvedValueOnce(row) foosballGame = await context.insertGame(FOOSBALL_DATA) @@ -302,7 +302,7 @@ describe('StorageContext', () => { }) describe('getLatestMatchByGameId', () => { describe('called with foosball id', () => { - let matchWithId: MatchWithId|null + let matchWithId: MatchWithId | null beforeEach(async () => { TRANSACTION_MOCK.executeSingleResultQuery.mockResolvedValueOnce(FOOSBALL_MATCH_ROW) matchWithId = await context.getLatestMatchByGameId(FOOSBALL_GAME.id) diff --git a/backend/storage/StorageContext.ts b/backend/storage/StorageContext.ts index 51836fc1..cc672e52 100644 --- a/backend/storage/StorageContext.ts +++ b/backend/storage/StorageContext.ts @@ -80,7 +80,7 @@ export class StorageContext { return dbTransformations.createUserFromDbRow(row) } - async getUserByName(userName: string): Promise { + async getUserByName(userName: string): Promise { let row try { row = await this.transaction.executeSingleResultQuery(dbQueries.selectUserByName, [userName]) @@ -213,7 +213,7 @@ export class StorageContext { return rows.map(dbTransformations.createMatchFromDbRow) } - async getLatestMatchByGameId(gameId: number): Promise { + async getLatestMatchByGameId(gameId: number): Promise { let row try { row = await this.transaction.executeSingleResultQuery( @@ -236,7 +236,7 @@ export class StorageContext { return rows.map(dbTransformations.createGameFromDbRow) } - async insertGame(game: GameData): Promise { + async insertGame(game: GameData): Promise { let row try { row = await this.transaction.executeSingleResultQuery(dbQueries.insertGame, [ diff --git a/backend/storage/db/db-transactions.ts b/backend/storage/db/db-transactions.ts index f02c626d..f32eb79c 100644 --- a/backend/storage/db/db-transactions.ts +++ b/backend/storage/db/db-transactions.ts @@ -3,7 +3,7 @@ import * as dbConfig from './db-config' const pool = new Pool(dbConfig.productionConfig) -type QueryValues = Array +type QueryValues = Array export class Transaction { private active: boolean @@ -22,7 +22,7 @@ export class Transaction { } async executeSingleResultQuery(query: string, values: QueryValues): - Promise { + Promise { const rows = await this.executeQuery(query, values) if (rows.length == 0) { return null @@ -52,7 +52,7 @@ export class Transaction { } } -export const beginTransaction = async (): Promise => { +export const beginTransaction = async (): Promise => { const client = await pool.connect() try { await client.query('BEGIN')