forked from Yara724/api
Fixed accident-details bug
This commit is contained in:
@@ -5132,10 +5132,14 @@ export class ClaimRequestManagementService {
|
||||
currentUserId: string,
|
||||
actorRole?: string,
|
||||
): Promise<string> {
|
||||
if (
|
||||
![RoleEnum.FIELD_EXPERT, RoleEnum.REGISTRAR].includes(actorRole as any) ||
|
||||
!claimCase?.blameRequestId
|
||||
) {
|
||||
const isFieldLikeRole = [
|
||||
RoleEnum.FIELD_EXPERT,
|
||||
RoleEnum.REGISTRAR,
|
||||
RoleEnum.FILE_MAKER,
|
||||
RoleEnum.FILE_REVIEWER,
|
||||
].includes(actorRole as any);
|
||||
|
||||
if (!isFieldLikeRole || !claimCase?.blameRequestId) {
|
||||
return currentUserId;
|
||||
}
|
||||
const blameRequest = await this.blameRequestDbService.findById(
|
||||
@@ -5143,7 +5147,7 @@ export class ClaimRequestManagementService {
|
||||
);
|
||||
if (!blameRequest || blameRequest.creationMethod !== "IN_PERSON")
|
||||
return currentUserId;
|
||||
if (actorRole === RoleEnum.FIELD_EXPERT) {
|
||||
if (actorRole === RoleEnum.FIELD_EXPERT || actorRole === RoleEnum.FILE_MAKER) {
|
||||
if (
|
||||
!blameRequest.expertInitiated ||
|
||||
!blameRequest.initiatedByFieldExpertId ||
|
||||
@@ -5151,7 +5155,7 @@ export class ClaimRequestManagementService {
|
||||
) {
|
||||
return currentUserId;
|
||||
}
|
||||
} else {
|
||||
} else if (actorRole === RoleEnum.REGISTRAR) {
|
||||
if (
|
||||
!blameRequest.registrarInitiated ||
|
||||
!blameRequest.initiatedByRegistrarId ||
|
||||
@@ -5160,6 +5164,8 @@ export class ClaimRequestManagementService {
|
||||
return currentUserId;
|
||||
}
|
||||
}
|
||||
// FILE_REVIEWER: no initiator-id check — they pick up any IN_PERSON expert
|
||||
// file after the FileMaker seals it, so we resolve the owner unconditionally.
|
||||
return (
|
||||
resolveDamagedPartyUserId(blameRequest) ??
|
||||
(claimCase.owner?.userId ? String(claimCase.owner.userId) : currentUserId)
|
||||
@@ -8051,8 +8057,14 @@ export class ClaimRequestManagementService {
|
||||
return !!party?.confirmation;
|
||||
}
|
||||
|
||||
private assertV3ClaimDocumentsPhase(blame: any): void {
|
||||
if (!(blame.expert?.decision as any)?.fields?.accidentWay) {
|
||||
private assertV3ClaimDocumentsPhase(
|
||||
blame: any,
|
||||
options?: { skipAccidentFieldsCheck?: boolean },
|
||||
): void {
|
||||
if (
|
||||
!options?.skipAccidentFieldsCheck &&
|
||||
!(blame.expert?.decision as any)?.fields?.accidentWay
|
||||
) {
|
||||
throw new BadRequestException(
|
||||
"Submit accident fields before uploading required documents.",
|
||||
);
|
||||
@@ -8336,7 +8348,9 @@ export class ClaimRequestManagementService {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.assertV3ClaimDocumentsPhase(blame);
|
||||
this.assertV3ClaimDocumentsPhase(blame, {
|
||||
skipAccidentFieldsCheck: actor?.role === "file_maker",
|
||||
});
|
||||
if (!this.isV3InitialDocumentsPhase(claimCase)) {
|
||||
throw new BadRequestException(
|
||||
`Upload initial required documents during ${ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS} before part selection. Current step: ${claimCase.workflow?.currentStep}`,
|
||||
@@ -8368,7 +8382,9 @@ export class ClaimRequestManagementService {
|
||||
const blame = await this.assertV3InPersonClaim(claimCase);
|
||||
|
||||
if (this.isV3InitialDocumentsPhase(claimCase)) {
|
||||
this.assertV3ClaimDocumentsPhase(blame);
|
||||
this.assertV3ClaimDocumentsPhase(blame, {
|
||||
skipAccidentFieldsCheck: actor?.role === "file_maker",
|
||||
});
|
||||
} else if (
|
||||
claimCase.workflow?.currentStep === ClaimWorkflowStep.CAPTURE_PART_DAMAGES
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user