all the haul

This commit is contained in:
2026-04-07 23:56:31 +00:00
parent 87cce83030
commit 24f303355b
244 changed files with 33743 additions and 11249 deletions
+47
View File
@@ -0,0 +1,47 @@
import {
TaxCode as CwTaxCode,
TaxCodeLevel as CwTaxCodeLevel,
} from "../../generated/prisma/client";
import { TaxCode as ApiTaxCode } from "../../../api/generated/prisma/client";
import { Translation } from "./types";
import { skipRow } from "./types";
type CwTaxCodeWithLevels = CwTaxCode & {
levels: CwTaxCodeLevel[];
};
export const taxCodeTranslation: Translation<
CwTaxCodeWithLevels,
ApiTaxCode
> = {
values: [
{ from: "taxCodeRecId", to: "id" },
{
from: "taxCodeId",
to: "code",
process: (value) => value ?? skipRow("taxCodeId is null"),
},
{
from: "codeCaption",
to: "codeCaption",
process: (value, _, row) =>
value ?? (row.taxCodeId as string | null) ?? "",
},
{ from: "description", to: "description" },
{
from: "taxCodeRecId",
to: "rate",
process: (_, __, row) => {
const level = (row as unknown as CwTaxCodeWithLevels).levels.find(
(l) => l.taxXref !== null
);
return level ? Number(level.taxRate) : null;
},
},
{ from: "defaultFlag", to: "defaultFlag" },
{ from: "enteredBy", to: "createdBy" },
{ from: "updatedBy", to: "updatedBy" },
{ from: "dateEnteredUtc", to: "createdAt" },
{ from: "lastUpdatedUtc", to: "updatedAt" },
],
};