diff --git a/backend/src/api/admin.ts b/backend/src/api/admin.ts index efffd8e..c4f85c2 100644 --- a/backend/src/api/admin.ts +++ b/backend/src/api/admin.ts @@ -5,7 +5,7 @@ import { TopupTable } from "types/topup" import { TransactionTable } from "types/transaction" import { UserTable, UserType } from "types/user" import Archiver from "archiver" -import { objectsToCsv } from "utils" +import { objectsToCsv as objectsToTsv } from "utils" import { getRandom } from "getRandom" import { hash } from "passwords" @@ -165,14 +165,14 @@ router.get("/dump", async (_, res) => { archive.pipe(res) await archive - .append(objectsToCsv(topups, topupHeaders), { - name: "topups.csv", + .append(objectsToTsv(topups, topupHeaders), { + name: "topups.tsv", }) - .append(objectsToCsv(transactions, transactionHeaders), { - name: "transactions.csv", + .append(objectsToTsv(transactions, transactionHeaders), { + name: "transactions.tsv", }) - .append(objectsToCsv(users, userHeaders), { - name: "users.csv", + .append(objectsToTsv(users, userHeaders), { + name: "users.tsv", }) .finalize() }) diff --git a/backend/src/utils.ts b/backend/src/utils.ts index e91b60d..01b0a3c 100644 --- a/backend/src/utils.ts +++ b/backend/src/utils.ts @@ -26,11 +26,11 @@ export function objectsToCsv( data: Record[], headers: string[], ): string { - const csv = [headers.join(",")] + const tsv = [headers.join("\t")] for (const row of data) { - csv.push(headers.map((key) => row[key]).join(",")) + tsv.push(headers.map((key) => row[key]).join("\t")) } - return csv.join("\n") + return tsv.join("\n") }