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
+63
View File
@@ -0,0 +1,63 @@
import { Contact as CwContact } from "../../generated/prisma/client";
import {
Contact as ApiContact,
GenderType,
PhoneType,
} from "../../../api/generated/prisma/client";
import { Translation } from "./types";
const toGender = (value: string | null): GenderType | null => {
if (!value) return null;
const normalized = value.trim().toUpperCase();
if (normalized === "M") return GenderType.MALE;
if (normalized === "F") return GenderType.FEMALE;
return null;
};
const toPhoneType = (value: string | null): PhoneType | null => {
if (!value) return null;
const normalized = value.trim().toUpperCase();
if (normalized === "DIRECT") return PhoneType.DIRECT;
if (normalized === "MOBILE") return PhoneType.MOBILE;
if (normalized === "HOME") return PhoneType.HOME;
if (normalized === "COMPANY") return PhoneType.COMPANY;
if (normalized === "SITE") return PhoneType.SITE;
return null;
};
export const contactTranslation: Translation<CwContact, ApiContact> = {
values: [
{ from: "contactRecId", to: "id" },
{
from: "inactiveFlag",
to: "active",
process: (value) => !value,
},
{
from: "defaultFlag",
to: "default",
process: (value) => Boolean(value),
},
{
from: "firstName",
to: "firstName",
process: (value) => (value ? value : "Unknown"),
},
{
from: "lastName",
to: "lastName",
process: (value) => (value ? value : "Contact"),
},
{ from: "nickName", to: "nickname" },
{ from: "title", to: "title" },
{ from: "gender", to: "gender", process: toGender },
{ from: "dateBirth", to: "birthday" },
{ from: "defaultPhoneNbr", to: "phone" },
{ from: "defaultPhoneExtension", to: "phoneExtension" },
{ from: "defaultPhoneType", to: "phoneType", process: toPhoneType },
{ from: "companyAddressRecId", to: "companyAddressId" },
{ from: "companyRecId", to: "companyId" },
{ from: "dateEnteredUtc", to: "createdAt" },
{ from: "lastUpdatedUtc", to: "updatedAt" },
],
};