feat: Add support for exporting products in backend (#8214)

CLOSES CC-221
CLOSES CC-223
CLOSES CC-224
This commit is contained in:
Stevche Radevski
2024-07-22 15:40:04 +02:00
committed by GitHub
parent e9f1aafbb1
commit 0d2e7befbd
29 changed files with 615 additions and 690 deletions

View File

@@ -0,0 +1 @@
export * from "./jsontocsv"

View File

@@ -0,0 +1,17 @@
import { json2csv } from "json-2-csv"
export interface ConvertJsonToCsvOptions<T> {}
export const convertJsonToCsv = <T extends object>(
data: T[],
options?: ConvertJsonToCsvOptions<T>
) => {
return json2csv(data, {
prependHeader: true,
arrayIndexesAsKeys: true,
expandNestedObjects: true,
expandArrayObjects: true,
unwindArrays: false,
emptyFieldValue: "",
})
}