forked from Yara724/api
fix: support manual accident addresses and expose final Fanavaran completion
Accept and persist address-only locations across user and expert flows, preserve workflow authorization, and include addresses in reports and Fanavaran review. Expose persisted final submission completion so the expert panel can prevent repeat sends.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { UserClaimBranchService, userClaimBranchContext, usesUserClaimBranch } from "src/client/user-claim-branch.service";
|
||||
import { normalizeAccidentLocation } from "./accident-location";
|
||||
import {
|
||||
BadRequestException,
|
||||
ConflictException,
|
||||
@@ -2659,7 +2660,8 @@ export class RequestManagementService {
|
||||
: undefined;
|
||||
}
|
||||
|
||||
party.location = body as any;
|
||||
const location = normalizeAccidentLocation(body);
|
||||
party.location = location;
|
||||
|
||||
await this.advanceWorkflowToNext(req, stepKey);
|
||||
|
||||
@@ -2673,7 +2675,7 @@ export class RequestManagementService {
|
||||
actorName: user?.fullName,
|
||||
actorType: "user",
|
||||
},
|
||||
metadata: { location: body, role },
|
||||
metadata: { location, role },
|
||||
} as any);
|
||||
|
||||
await (req as any).save();
|
||||
@@ -5584,7 +5586,7 @@ export class RequestManagementService {
|
||||
if (!dto?.location) {
|
||||
throw new BadRequestException("location is required");
|
||||
}
|
||||
req.parties[firstIdx].location = dto.location as any;
|
||||
req.parties[firstIdx].location = normalizeAccidentLocation(dto.location);
|
||||
|
||||
const completed = Array.isArray(req.workflow?.completedSteps)
|
||||
? req.workflow.completedSteps
|
||||
@@ -8505,7 +8507,7 @@ export class RequestManagementService {
|
||||
if ((req as any).isMadeByFileMaker) {
|
||||
const role = this.resolvePartyRoleV3(req, partyRole);
|
||||
const idx = this.getPartyIndex(req, role);
|
||||
if (idx !== -1 && body) req.parties[idx].location = body as any;
|
||||
if (idx !== -1 && body) req.parties[idx].location = normalizeAccidentLocation(body);
|
||||
await (req as any).save();
|
||||
return { requestId: req._id, publicId: req.publicId, partyRole: role };
|
||||
}
|
||||
@@ -8516,7 +8518,8 @@ export class RequestManagementService {
|
||||
const idx = this.getPartyIndex(req, role);
|
||||
if (idx === -1) throw new BadRequestException(`${role} party not found`);
|
||||
|
||||
req.parties[idx].location = body as any;
|
||||
const location = normalizeAccidentLocation(body);
|
||||
req.parties[idx].location = location;
|
||||
|
||||
if (!Array.isArray(req.history)) req.history = [];
|
||||
req.history.push({
|
||||
@@ -8526,7 +8529,7 @@ export class RequestManagementService {
|
||||
actorName: `${actor.firstName || ""} ${actor.lastName || ""}`.trim(),
|
||||
actorType: this.resolveBlameHistoryActorType(actor),
|
||||
},
|
||||
metadata: { partyRole: role, location: body },
|
||||
metadata: { partyRole: role, location },
|
||||
} as any);
|
||||
|
||||
await (req as any).save();
|
||||
|
||||
Reference in New Issue
Block a user