Enforce claim beneficiary access and retire unused legacy APIs

This commit is contained in:
SepehrYahyaee
2026-10-05 14:39:51 +03:30
parent 0735333467
commit a3f9aab8fb
104 changed files with 6864 additions and 13223 deletions
+14 -38
View File
@@ -10,20 +10,13 @@ import {
ServiceUnavailableException,
UnauthorizedException,
} from "@nestjs/common";
import { SandHubDbService } from "src/sand-hub/entity/db-service/sand-hub.db.service";
import { SandHubModel } from "src/sand-hub/entity/schema/sand-hub.schema";
import { ExternalInquirySettingsService } from "src/client/external-inquiry-settings.service";
import { PlateNormalizerService } from "src/utils/plate-normalizer/plate-normalizer.service";
import type { ExternalInquiryType } from "src/common/types/external-inquiry.types";
import type { MockInquiryCompanyContext } from "src/common/types/external-inquiry.types";
import { OfflineInquiryService } from "src/offline-inquiry/offline-inquiry.service";
import { LookupsService } from "src/lookups/lookups.service";
import { resolveFanavaranClientKey } from "src/core/config/fanavaran-client.config";
import { SandHubDetailDto, SandHubInquiryOptions } from "./dto/sand-hub.dto";
import { jalaliToGregorianDate } from "src/helpers/date-jalali";
import { firstValueFrom } from "rxjs";
import { mapEsgCarBodyPolicyToInquiry } from "./esg-car-body-inquiry.mapper";
import type { Plates } from "src/Types&Enums/plate.interface";
import { ExternalInquirySettingsService } from "src/client/external-inquiry-settings.service";
import type {
ExternalInquiryType,
MockInquiryCompanyContext,
} from "src/common/types/external-inquiry.types";
import {
getInquiryErrorMessage,
inquiryErrorStatus,
@@ -31,6 +24,14 @@ import {
isInquiryTimeout,
type InquiryErrorContext,
} from "src/common/utils/inquiry-error";
import { resolveFanavaranClientKey } from "src/core/config/fanavaran-client.config";
import { jalaliToGregorianDate } from "src/helpers/date-jalali";
import { LookupsService } from "src/lookups/lookups.service";
import { OfflineInquiryService } from "src/offline-inquiry/offline-inquiry.service";
import { PlateNormalizerService } from "src/utils/plate-normalizer/plate-normalizer.service";
import { SandHubDetailDto, SandHubInquiryOptions } from "./dto/sand-hub.dto";
import { mapEsgCarBodyPolicyToInquiry } from "./esg-car-body-inquiry.mapper";
type CarBodyInquiryDetail = Omit<SandHubDetailDto, "plate"> & {
plate: Plates | string;
@@ -52,7 +53,7 @@ export class SandHubService {
constructor(
private readonly httpService: HttpService,
private readonly sandHubDbService: SandHubDbService,
private readonly externalInquirySettings: ExternalInquirySettingsService,
private readonly plateNormalizer: PlateNormalizerService,
private readonly offlineInquiryService: OfflineInquiryService,
@@ -977,10 +978,6 @@ export class SandHubService {
return { raw, mapped };
}
async getSandHubDataFromId(sandHubId) {
return await this.sandHubDbService.findOneBySandHubId(sandHubId);
}
/**
* CAR_BODY is the only ESG product that uses the processed Fanavaran lookup.
* THIRD_PARTY remains on its established provider-specific inquiry path.
@@ -1781,25 +1778,4 @@ export class SandHubService {
);
}
}
async sandHubDocumentCreator(
userId: string,
requestId: string,
doc: Partial<SandHubModel>,
) {
const existingDoc = await this.sandHubDbService.findOneByRequestId(
requestId,
userId,
);
if (!existingDoc) {
return await this.sandHubDbService.create({ ...doc, userId, requestId });
} else {
const updatePayload = { ...existingDoc, ...doc };
return await this.sandHubDbService.findOneByRequestIdAndUpdate(
requestId,
userId,
updatePayload,
);
}
}
}