lookups update per client

This commit is contained in:
2026-06-23 18:23:09 +03:30
parent 16cdf2e7b0
commit c7fb6174a0
8 changed files with 469 additions and 32 deletions

View File

@@ -0,0 +1,58 @@
import type { FanavaranClientKey } from "src/core/config/fanavaran-client.config";
export const FANAVARAN_LOOKUP_BASE_URL =
"https://apimanager.iraneit.com/BimeApiManager/api/BimeApi/v2.0";
export interface FanavaranRemoteLookupDefinition {
name: string;
url: string;
cacheFile: string;
}
/** Fanavaran API lookups synced per client (Parsian fetches on first call). */
export const FANAVARAN_REMOTE_LOOKUPS: FanavaranRemoteLookupDefinition[] = [
{
name: "accident-causes",
url: `${FANAVARAN_LOOKUP_BASE_URL}/car/base-info/accident-causes`,
cacheFile: "accident-causes.json",
},
{
name: "accident-report-type",
url: `${FANAVARAN_LOOKUP_BASE_URL}/car/code-list/accident-report-type`,
cacheFile: "accident-report-type.json",
},
{
name: "vehicle-use-types",
url: `${FANAVARAN_LOOKUP_BASE_URL}/car/base-info/vehicle-use-types`,
cacheFile: "vehicle-use-types.json",
},
{
name: "dmg-pay-method",
url: `${FANAVARAN_LOOKUP_BASE_URL}/car/code-list/dmg-pay-method`,
cacheFile: "dmg-pay-method.json",
},
{
name: "driving-licence-types",
url: `${FANAVARAN_LOOKUP_BASE_URL}/car/base-info/driving-licence-types`,
cacheFile: "driving-licence-types.json",
},
{
name: "accident-culprit-type",
url: `${FANAVARAN_LOOKUP_BASE_URL}/car/code-list/accident-culprit-type`,
cacheFile: "accident-culprit-type.json",
},
];
export const TEJARAT_STATIC_ACCIDENT_FILES = {
accidentReason: "ACCIDENT_REASON.json",
accidentWay: "ACCIDENT_WAY.json",
accidentType: "ACCIDENT_TYPE.json",
} as const;
export function fanavaranLookupCacheDir(clientKey: FanavaranClientKey): string {
return `${process.cwd()}/files/fanavaran-lookups/${clientKey}`;
}
export function tejaratStaticAccidentFilePath(fileName: string): string {
return `${process.cwd()}/src/static/${fileName}`;
}