Midday / packages /import /src /mappings.ts
Jules
Final deployment with all fixes and verified content
c09f67c
import type { Transaction } from "./types";
export const mapTransactions = (
data: Record<string, string>[],
mappings: Record<string, string>,
currency: string,
teamId: string,
bankAccountId: string,
): Transaction[] => {
return data.map((row) => ({
...(Object.fromEntries(
Object.entries(mappings)
.filter(([_, value]) => value !== "")
.map(([key, value]) => [key, row[value]]),
) as Transaction),
currency,
teamId,
bankAccountId,
}));
};