Add in AD2 decode.

This commit is contained in:
Patrick Fic
2025-03-17 14:54:59 -07:00
parent c1949eb5f9
commit 8cfc9ec6a6
9 changed files with 362 additions and 44 deletions

View File

@@ -2,6 +2,7 @@ import { DBFFile } from "dbffile";
import log from "electron-log/main";
import _ from "lodash";
import deepLowerCaseKeys from "../../util/deepLowercaseKeys";
import { OwnerRecordInterface, ParsedAD1 } from "./decode-ad1.interface";
const DecodeAD1 = async (extensionlessFilePath: string): Promise<ParsedAD1> => {
let dbf;
@@ -15,9 +16,7 @@ const DecodeAD1 = async (extensionlessFilePath: string): Promise<ParsedAD1> => {
if (!dbf) {
log.error(`Could not find any AD1 files at ${extensionlessFilePath}`);
return {
id: 0,
};
return null;
}
const rawDBFRecord = await dbf.readRecords(1);
@@ -200,20 +199,3 @@ const DecodeAD1 = async (extensionlessFilePath: string): Promise<ParsedAD1> => {
return { ...rawAd1Data, owner: { data: ownerRecord } };
};
export default DecodeAD1;
interface OwnerRecordInterface {
ownr_ln: string;
ownr_fn: string;
ownr_title: string;
ownr_co_nm: string;
ownr_addr1: string;
ownr_addr2: string;
ownr_city: string;
ownr_st: string;
ownr_zip: string;
ownr_ctry: string;
ownr_ph1: string;
ownr_ph2: string;
ownr_ea: string;
shopid: string;
}