Reformat.

This commit is contained in:
Patrick Fic
2025-03-21 11:41:42 -07:00
parent 14e7c64eab
commit d14137dc44
34 changed files with 380 additions and 339 deletions

View File

@@ -7,7 +7,7 @@ import store from "../store/store";
import { DecodedAd1, OwnerRecordInterface } from "./decode-ad1.interface";
const DecodeAD1 = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedAd1> => {
let dbf: DBFFile | null = null;
try {
@@ -147,7 +147,7 @@ const DecodeAD1 = async (
"INS_CT_PH",
"INS_CT_PHX",
"LOSS_CAT",
])
]),
);
//Copy specific logic for manipulation.

View File

@@ -6,7 +6,7 @@ import { DecodedAD2 } from "./decode-ad2.interface";
import errorTypeCheck from "../../util/errorTypeCheck";
const DecodeAD2 = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedAD2> => {
let dbf: DBFFile | null = null;
try {
@@ -135,7 +135,7 @@ const DecodeAD2 = async (
//"LOC_PH",
//"LOC_PHX",
//"LOC_EA",
])
]),
);
//Apply business logic transfomrations.

View File

@@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck";
import { DecodedEnv } from "./decode-env.interface";
const DecodeEnv = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedEnv> => {
let dbf: DBFFile | null = null;
try {
@@ -32,7 +32,7 @@ const DecodeEnv = async (
//TODO: Several of these fields will fail. Should extend schema to capture them.
//"EST_SYSTEM",
"ESTFILE_ID",
])
]),
);
rawEnvData.ciecaid = rawEnvData.estfile_id;
delete rawEnvData.estfile_id;

View File

@@ -7,7 +7,7 @@ import store from "../store/store";
import { DecodedLin, DecodedLinLine } from "./decode-lin.interface";
const DecodeLin = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedLin> => {
let dbf: DBFFile | null = null;
try {
@@ -80,7 +80,7 @@ const DecodeLin = async (
"BETT_PCTG",
"BETT_AMT",
"BETT_TAX",
])
]),
);
//Apply line by line adjustments.
singleLineData.op_code_desc = opCodeData[singleLineData.lbr_op]?.desc;

View File

@@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck";
import { DecodedPfh } from "./decode-pfh.interface";
const DecodePfh = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedPfh> => {
let dbf: DBFFile | null = null;
try {
@@ -50,7 +50,7 @@ const DecodePfh = async (
"ADJ_STRDIS",
//"ADJ_BTR_IN", //Remove
"TAX_PREDIS",
])
]),
);
//Apply business logic transfomrations.

View File

@@ -10,7 +10,7 @@ import {
} from "./decode-pfl.interface";
const DecodePfl = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedPfl> => {
let dbf: DBFFile | null = null;
try {
@@ -67,7 +67,7 @@ const DecodePfl = async (
"LBR_TX_IN4",
"LBR_TX_TY5",
"LBR_TX_IN5",
])
]),
);
//Apply line by line adjustments.
//Set the job.rate_<CIECA_TYPE> field based on the value.

View File

@@ -11,7 +11,7 @@ import {
} from "./decode-pfm.interface";
const DecodePfm = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedPfm> => {
let dbf: DBFFile | null = null;
try {
@@ -80,8 +80,8 @@ const DecodePfm = async (
"MAT_TX_IN4",
"MAT_TX_TY5",
"MAT_TX_IN5",
])
)
]),
),
);
//Also capture the whole object.
@@ -93,7 +93,7 @@ const DecodePfm = async (
//Apply line by line adjustments.
const mapaLine: DecodedPfmLine | undefined = rawPfmData.find(
(line) => line.matl_type === "MAPA"
(line) => line.matl_type === "MAPA",
);
if (mapaLine) {
jobMaterialRates.rate_mapa =
@@ -102,7 +102,7 @@ const DecodePfm = async (
}
const mashLine: DecodedPfmLine | undefined = rawPfmData.find(
(line) => line.matl_type === "MASH"
(line) => line.matl_type === "MASH",
);
if (mashLine) {
jobMaterialRates.rate_mash =
@@ -111,7 +111,7 @@ const DecodePfm = async (
}
const mahwLine: DecodedPfmLine | undefined = rawPfmData.find(
(line) => line.matl_type === "MAHW"
(line) => line.matl_type === "MAHW",
);
if (mahwLine) {
jobMaterialRates.rate_mahw =
@@ -122,7 +122,7 @@ const DecodePfm = async (
const additionalMaterials = ["MA2S", "MA2T", "MA3S", "MACS", "MABL"];
additionalMaterials.forEach((type) => {
const line: DecodedPfmLine | undefined = rawPfmData.find(
(line) => line.matl_type === type
(line) => line.matl_type === type,
);
if (line) {
jobMaterialRates[`rate_${type.toLowerCase()}`] =

View File

@@ -7,7 +7,7 @@ import YNBoolConverter from "../../util/ynBoolConverter";
import { DecodedPfo, DecodedPfoLine } from "./decode-pfo.interface";
const DecodePfo = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedPfo> => {
let dbf: DBFFile | null = null;
try {
@@ -58,8 +58,8 @@ const DecodePfo = async (
"STOR_T_IN5",
"STOR_T_TY6",
"STOR_T_IN6",
])
)
]),
),
);
//Apply business logic transfomrations.

View File

@@ -11,7 +11,7 @@ import {
} from "./decode-pfp.interface";
const DecodePfp = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedPfp> => {
let dbf: DBFFile | null = null;
try {
@@ -51,7 +51,7 @@ const DecodePfp = async (
"PRT_TX_IN4",
"PRT_TX_TY5",
"PRT_TX_IN5",
])
]),
);
singleLineData.prt_tax_rt = singleLineData.prt_tax_rt / 100;
@@ -66,7 +66,7 @@ const DecodePfp = async (
acc[line.prt_type] = line;
return acc;
},
{} as DecodedPfpLinesByType
{} as DecodedPfpLinesByType,
);
return { parts_tax_rates: parsedPfpFile };

View File

@@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck";
import { DecodedPft, DecodedPftLine } from "./decode-pft.interface";
const DecodePft = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedPft> => {
let dbf: DBFFile | null = null;
try {
@@ -154,7 +154,7 @@ const DecodePft = async (
"TY6_THRES5",
"TY6_RATE5",
"TY6_SUR5",
])
]),
);
//Apply business logic transfomrations.

View File

@@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck";
import { DecodedTtl, DecodedTtlLine } from "./decode-ttl.interface";
const DecodeTtl = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedTtl> => {
let dbf: DBFFile | null = null;
try {
@@ -42,7 +42,7 @@ const DecodeTtl = async (
"G_TTL_DISC",
"G_TAX",
"GST_AMT",
])
]),
);
//Apply business logic transfomrations.

View File

@@ -7,7 +7,7 @@ import errorTypeCheck from "../../util/errorTypeCheck";
import store from "../store/store";
const DecodeVeh = async (
extensionlessFilePath: string
extensionlessFilePath: string,
): Promise<DecodedVeh> => {
let dbf: DBFFile | null = null;
try {
@@ -56,7 +56,7 @@ const DecodeVeh = async (
"PAINT_CD1",
"PAINT_CD2",
"PAINT_CD3",
])
]),
);
//Apply business logic transfomrations.

View File

@@ -10,7 +10,7 @@ const requestMiddleware: RequestMiddleware = async (request) => {
`%c[Graphql Request]%c${request.operationName}`,
"color: red",
"color: green",
request
request,
);
return {
@@ -23,7 +23,7 @@ const client: GraphQLClient = new GraphQLClient(
import.meta.env.VITE_GRAPHQL_ENDPOINT,
{
requestMiddleware,
}
},
);
export async function getTokenFromRenderer(): Promise<string> {
@@ -35,7 +35,7 @@ export async function getTokenFromRenderer(): Promise<string> {
} catch (error) {
log.error(
"Unable to send request to renderer process for token",
errorTypeCheck(error)
errorTypeCheck(error),
);
}

View File

@@ -154,7 +154,7 @@ function createWindow(): void {
label: "Log the Store",
click: (): void => {
log.debug(
"Store Contents" + JSON.stringify(store.store, null, 4)
"Store Contents" + JSON.stringify(store.store, null, 4),
);
},
},
@@ -171,7 +171,7 @@ function createWindow(): void {
jobs
{
id}}
`
`,
)
.then((data) => {
log.info("Data from graffle", data);

View File

@@ -27,7 +27,7 @@ const logIpcMessages = (): void => {
`%c[IPC Main]%c${messageType}`,
"color: red",
"color: green",
payload
payload,
);
// Call original handler if it existed
if (originalHandler) {
@@ -38,7 +38,7 @@ const logIpcMessages = (): void => {
};
ipcMain.on(ipcTypes.toMain.test, () =>
console.log("** Verify that ipcMain is loaded and working.")
console.log("** Verify that ipcMain is loaded and working."),
);
//Auth handler
@@ -67,15 +67,15 @@ if (import.meta.env.DEV) {
//Settings Handlers
ipcMain.handle(
ipcTypes.toMain.settings.filepaths.get,
SettingsWatchedFilePathsGet
SettingsWatchedFilePathsGet,
);
ipcMain.handle(
ipcTypes.toMain.settings.filepaths.add,
SettingsWatchedFilePathsAdd
SettingsWatchedFilePathsAdd,
);
ipcMain.handle(
ipcTypes.toMain.settings.filepaths.remove,
SettingsWatchedFilePathsRemove
SettingsWatchedFilePathsRemove,
);
//Watcher Handlers

View File

@@ -17,7 +17,7 @@ const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
if (!result.canceled) {
Store.set(
"settings.filepaths",
_.union(result.filePaths, Store.get("settings.filepaths"))
_.union(result.filePaths, Store.get("settings.filepaths")),
);
addWatcherPath(result.filePaths);
}
@@ -26,11 +26,11 @@ const SettingsWatchedFilePathsAdd = async (): Promise<string[]> => {
};
const SettingsWatchedFilePathsRemove = async (
event: IpcMainInvokeEvent,
path: string
path: string,
): Promise<string[]> => {
Store.set(
"settings.filepaths",
_.without(Store.get("settings.filepaths"), path)
_.without(Store.get("settings.filepaths"), path),
);
removeWatcherPath(path);
return Store.get("settings.filepaths");

View File

@@ -12,14 +12,14 @@ import log from "electron-log/main";
const ipcMainHandleAuthStateChanged = async (
event: IpcMainEvent,
user: User | null
user: User | null,
): Promise<void> => {
Store.set("user", user);
//Need to query the currently active shop, and store the metadata as well.
//Also need to query the OP Codes for decoding reference.
const activeBodyshop: ActiveBodyshopQueryResult = await client.request(
QUERY_ACTIVE_BODYSHOP_TYPED
QUERY_ACTIVE_BODYSHOP_TYPED,
);
Store.set("app.bodyshop", activeBodyshop.bodyshops[0]);
@@ -28,7 +28,7 @@ const ipcMainHandleAuthStateChanged = async (
QUERY_MASTERDATA_TYPED,
{
key: `${activeBodyshop.bodyshops[0].region_config}_ciecaopcodes`,
}
},
);
Store.set("app.masterdata.opcodes", JSON.parse(OpCodes.masterdata[0]?.value));
log.debug("Received authentication state change from Renderer.", user);