Skip to content

Commit

Permalink
chore: comment out file system logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragura committed Oct 31, 2023
1 parent 377d445 commit ed5bc08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/api/games/collection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { writeFileSync } from 'node:fs'
import { ofetch } from 'ofetch'
import { xmlParser , mergeAttributes } from '../../utils/parser'
import { Collection } from 'src/types/collection'
Expand Down Expand Up @@ -50,6 +49,6 @@ export async function findCollection(userName: string) {
const response = await ofetch<string>(
`https://www.boardgamegeek.com/xmlapi/collection/${userName}?${searchParams}`
)
writeFileSync('logs/collection.xml', response)
// writeFileSync('logs/collection.xml', response)
parseCollection(response)
}
7 changes: 3 additions & 4 deletions src/api/games/find-game-by-id.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { writeFileSync } from 'node:fs'
import { ofetch } from 'ofetch'
import { mergeAttributes, parsePoll, xmlParser } from '../../utils/parser.js'
import { renameProperties } from '../../utils/names.js'
Expand Down Expand Up @@ -34,11 +33,11 @@ export function parseFindGameByIds(xmlString: string) {
const resultParsed = xmlParser.parse(xmlString)
// writeFileSync('logs/find-game-by-ids-parsed-xml.json', JSON.stringify(resultParsed, undefined, 2));
const resultMerged = mergeAttributes(resultParsed)
writeFileSync('logs/find-game-by-ids-merged.json', JSON.stringify(resultMerged, undefined, 2));
// writeFileSync('logs/find-game-by-ids-merged.json', JSON.stringify(resultMerged, undefined, 2));
const games = resultMerged.boardgames.boardgame.map(
(game: Record<string, any>) => parseFindGameByIdGame(game)
)
writeFileSync('logs/find-game-by-ids.json', JSON.stringify(games, undefined, 2));
// writeFileSync('logs/find-game-by-ids.json', JSON.stringify(games, undefined, 2));
return games
}

Expand Down Expand Up @@ -100,7 +99,7 @@ export async function findGameByIds(ids: number[], options: findGameByIdOptions
const response = await ofetch<string>(
`https://www.boardgamegeek.com/xmlapi/boardgame/${ids.join(',')}?${searchParams}`
)
writeFileSync('logs/find-game-by-ids.xml', response);
// writeFileSync('logs/find-game-by-ids.xml', response);
const result = parseFindGameByIds(response)
return result
}
7 changes: 3 additions & 4 deletions src/api/games/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { writeFileSync } from 'node:fs'
import { ofetch } from 'ofetch'
import { mergeAttributes, xmlParser } from '../../utils/parser'

Expand Down Expand Up @@ -39,11 +38,11 @@ export function parseSearchGame(xmlString: string): GameSearchResult[] {
if (!resultMerged.boardgames.boardgame)
return []

writeFileSync('logs/search-merged.json', JSON.stringify(resultMerged, undefined, 2));
// writeFileSync('logs/search-merged.json', JSON.stringify(resultMerged, undefined, 2));
const games = resultMerged.boardgames.boardgame.map(
(boardGame: MergedResultGame) => parseBoardGame(boardGame)
)
writeFileSync('logs/search.json', JSON.stringify(games, undefined, 2));
// writeFileSync('logs/search.json', JSON.stringify(games, undefined, 2));
return games
}

Expand All @@ -52,6 +51,6 @@ export async function findGame(name: string) {
search: name,
})
const response = await ofetch<string>(`https://www.boardgamegeek.com/xmlapi/search?${searchParams}`)
writeFileSync('logs/search.xml', response);
// writeFileSync('logs/search.xml', response);
parseSearchGame(response)
}

0 comments on commit ed5bc08

Please sign in to comment.