forked from Yara724/api
dynamic locations
This commit is contained in:
@@ -3365,17 +3365,15 @@ export class ClaimRequestManagementService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsian + V4/V5 FileMaker flows: Location from file-maker.locations[].id,
|
||||
* else file-reviewer.locations[].id, else tenant auth.location.
|
||||
* Fanavaran HTTP Location from assigned staff `locations[].id`
|
||||
* (file-maker / file-reviewer / field / blame / damage expert), for every
|
||||
* tenant. Falls back to tenant auth.location only when no staff location is set.
|
||||
*/
|
||||
private async resolveFanavaranLocationForClaim(
|
||||
claimCaseId: string,
|
||||
clientKey: FanavaranClientKey,
|
||||
): Promise<string> {
|
||||
const defaultLocation = getFanavaranClientProfile(clientKey).auth.location;
|
||||
if (clientKey !== "parsian") {
|
||||
return defaultLocation;
|
||||
}
|
||||
|
||||
try {
|
||||
const claimCase = await this.claimCaseDbService.findById(claimCaseId);
|
||||
@@ -3386,19 +3384,21 @@ export class ClaimRequestManagementService {
|
||||
const blame = await this.blameRequestDbService.findById(
|
||||
String(claimCase.blameRequestId),
|
||||
);
|
||||
if (!(blame as any)?.isMadeByFileMaker) {
|
||||
if (!blame) {
|
||||
return defaultLocation;
|
||||
}
|
||||
|
||||
return this.fanavaranLocationService.resolveBusinessLocation({
|
||||
clientKey,
|
||||
isMadeByFileMaker: true,
|
||||
fileMakerId: (blame as any)?.initiatedByFieldExpertId
|
||||
? String((blame as any).initiatedByFieldExpertId)
|
||||
: null,
|
||||
fileReviewerId: (blame as any)?.assignedFileReviewerId
|
||||
? String((blame as any).assignedFileReviewerId)
|
||||
: null,
|
||||
staffCandidateIds: [
|
||||
(blame as any)?.initiatedByFieldExpertId,
|
||||
(blame as any)?.expert?.assignedExpertId,
|
||||
(blame as any)?.expert?.decision?.decidedByExpertId,
|
||||
(claimCase as any)?.initiatedByFieldExpertId,
|
||||
this.fanavaranDamageReplyActorId(claimCase),
|
||||
(claimCase as any)?.workflow?.assignedForReviewBy?.actorId,
|
||||
(blame as any)?.assignedFileReviewerId,
|
||||
],
|
||||
});
|
||||
} catch (error) {
|
||||
this.logger.warn(
|
||||
|
||||
Reference in New Issue
Block a user