Skip to content

Commit

Permalink
gh-133: Surround | with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
littlewhywhat committed Apr 29, 2020
1 parent 9a5987d commit e613ace
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/bot/bot-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class SingleChannelBot {
}

export const makeBot =
(botToken: string|undefined, channelName: string|undefined): Promise<SingleChannelBot> => {
(botToken: string | undefined, channelName: string | undefined): Promise<SingleChannelBot> => {
return new Promise((resolve, reject): void => {
if (!botToken || !channelName) {
reject(Error('botToken or channelName missing'))
Expand Down
2 changes: 1 addition & 1 deletion backend/repositories/MatchRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Promise<Match> => {
)
}

const getElapsedSecondsSinceLatestMatch = async (gameId: number): Promise<number|null> => {
const getElapsedSecondsSinceLatestMatch = async (gameId: number): Promise<number | null> => {
const latestMatch = await storage.getLatestMatchByGameId(gameId)
if (latestMatch == null) {
return null
Expand Down
4 changes: 2 additions & 2 deletions backend/storage/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const getAllMatches = async (): Promise<Array<MatchWithId>> => {
return executeAndCommit(context => context.getAllMatches())
}

export const getLatestMatchByGameId = async (gameId: number): Promise<MatchWithId|null> => {
export const getLatestMatchByGameId = async (gameId: number): Promise<MatchWithId | null> => {
return executeAndCommit(context => context.getLatestMatchByGameId(gameId))
}

Expand All @@ -64,7 +64,7 @@ export const getGameByName = async (name: string): Promise<Game> => {
return executeAndCommit(context => context.getGameByName(name))
}

export const insertGame = async (game: GameData): Promise<Game|null> => {
export const insertGame = async (game: GameData): Promise<Game | null> => {
return executeAndCommit(context => context.insertGame(game))
}

Expand Down
4 changes: 2 additions & 2 deletions backend/storage/StorageContext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions backend/storage/StorageContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StorageContext {
return dbTransformations.createUserFromDbRow(row)
}

async getUserByName(userName: string): Promise<User|null> {
async getUserByName(userName: string): Promise<User | null> {
let row
try {
row = await this.transaction.executeSingleResultQuery(dbQueries.selectUserByName, [userName])
Expand Down Expand Up @@ -213,7 +213,7 @@ export class StorageContext {
return rows.map(dbTransformations.createMatchFromDbRow)
}

async getLatestMatchByGameId(gameId: number): Promise<MatchWithId|null> {
async getLatestMatchByGameId(gameId: number): Promise<MatchWithId | null> {
let row
try {
row = await this.transaction.executeSingleResultQuery(
Expand All @@ -236,7 +236,7 @@ export class StorageContext {
return rows.map(dbTransformations.createGameFromDbRow)
}

async insertGame(game: GameData): Promise<Game|null> {
async insertGame(game: GameData): Promise<Game | null> {
let row
try {
row = await this.transaction.executeSingleResultQuery(dbQueries.insertGame, [
Expand Down
6 changes: 3 additions & 3 deletions backend/storage/db/db-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as dbConfig from './db-config'

const pool = new Pool(dbConfig.productionConfig)

type QueryValues = Array<string|number|boolean|Date>
type QueryValues = Array<string | number | boolean | Date>

export class Transaction {
private active: boolean
Expand All @@ -22,7 +22,7 @@ export class Transaction {
}

async executeSingleResultQuery(query: string, values: QueryValues):
Promise<QueryResultRow|null> {
Promise<QueryResultRow | null> {
const rows = await this.executeQuery(query, values)
if (rows.length == 0) {
return null
Expand Down Expand Up @@ -52,7 +52,7 @@ export class Transaction {
}
}

export const beginTransaction = async (): Promise<Transaction|null> => {
export const beginTransaction = async (): Promise<Transaction | null> => {
const client = await pool.connect()
try {
await client.query('BEGIN')
Expand Down

0 comments on commit e613ace

Please sign in to comment.