Skip to content

Commit

Permalink
fix TS #96
Browse files Browse the repository at this point in the history
  • Loading branch information
djobbo committed Oct 12, 2023
1 parent 8f9b211 commit 73e3727
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 66 deletions.
6 changes: 3 additions & 3 deletions packages/bhapi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ export const get2v2Rankings = async (region: RankedRegion, page: number) => {
return rankings2v2Mock
}

export const getPlayerStats = async (playerId: string) =>
export const getPlayerStats = async (playerId: string | number) =>
__DEV ? playerStatsMock : getBhApi<PlayerStats>(`/player/${playerId}/stats`)

export const getPlayerRanked = async (playerId: string) =>
export const getPlayerRanked = async (playerId: string | number) =>
__DEV
? playerRankedMock
: getBhApi<PlayerRanked>(`/player/${playerId}/ranked`)

export const getClan = async (clanId: string) =>
export const getClan = async (clanId: string | number) =>
__DEV ? clanMock : getBhApi<Clan>(`/clan/${clanId}`)

export const getAllLegends = async () => getBhApi("/legend/all")
Expand Down
8 changes: 4 additions & 4 deletions packages/server/mutations/updateDBPlayerData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export const updateDBPlayerData = async (
falls,
suicides,
teamkos,
damagedealt,
damagetaken,
damageDealt,
damageTaken,
} = getLegendsAccumulativeData(legends)

const { unarmed, gadgets, throws } = getWeaponlessData(legends)
Expand All @@ -84,8 +84,8 @@ export const updateDBPlayerData = async (
rankedWins: playerRanked.wins,
tier: playerRanked.tier,
region: playerRanked.region,
damageDealt: damagedealt,
damageTaken: damagetaken,
damageDealt,
damageTaken,
kos,
falls,
suicides,
Expand Down
13 changes: 8 additions & 5 deletions packages/server/router/stats/getRankings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { getRankings } from "bhapi"
import {
get1v1Rankings as get1v1RankingsFn,
get2v2Rankings as get2v2RankingsFn,
} from "bhapi"
import { logInfo } from "logger"
import { numericLiteralValidator } from "common/helpers/validators"
import { publicProcedure } from "../../trpc"
Expand All @@ -22,9 +25,9 @@ export const get1v1Rankings = publicProcedure //
// const controller = new AbortController()

const rankings = await withTimeLog(
getRankings,
get1v1RankingsFn,
"BHAPI:rankings1v1",
)("1v1", region, page, name)
)(region, page, name)

// Fire and forget
// const fireAndForget = withTimeLog(
Expand Down Expand Up @@ -67,9 +70,9 @@ export const get2v2Rankings = publicProcedure //
// const controller = new AbortController()

const rankings = await withTimeLog(
getRankings,
get2v2RankingsFn,
"BHAPI:rankings2v2",
)("2v2", region, page)
)(region, page)

// Fire and forget
// const fireAndForget = withTimeLog(
Expand Down
52 changes: 0 additions & 52 deletions packages/web-parser/common/dev.ts

This file was deleted.

4 changes: 2 additions & 2 deletions worker/src/crawler/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatTime } from "common/helpers/date"
import { getPlayerStats, getRankings } from "bhapi"
import { get1v1Rankings, getPlayerStats } from "bhapi"
import { logInfo, logWarning } from "logger"
import { supabaseService } from "db/supabase/service"
import { updateDBPlayerData } from "server/mutations/updateDBPlayerData"
Expand Down Expand Up @@ -68,7 +68,7 @@ const createCrawlerQueue = async (config: CrawlerConfig) => {

logInfo("Crawling leaderboard page", currentPage)
const players = await requestWithMinimumDelay(
() => getRankings("1v1", "all", currentPage),
() => get1v1Rankings("all", currentPage),
delayMs,
)

Expand Down

0 comments on commit 73e3727

Please sign in to comment.