forked from Yara724/api
Fixed signature error for car-body
This commit is contained in:
@@ -5739,7 +5739,7 @@ export class RequestManagementService {
|
||||
}
|
||||
|
||||
/**
|
||||
* V2: User signs and accepts/rejects expert decision
|
||||
* V2: User signs and accepts/rejects (expert decision for THIRD_PARTY, or final acknowledgment for CAR_BODY).
|
||||
*/
|
||||
async userSignDecisionV2(
|
||||
requestId: string,
|
||||
@@ -5763,8 +5763,12 @@ export class RequestManagementService {
|
||||
);
|
||||
}
|
||||
|
||||
// Validate expert decision exists
|
||||
if (!request.expert?.decision) {
|
||||
// THIRD_PARTY: blame expert must have issued a guilt decision before signatures.
|
||||
// CAR_BODY: single-party flow; no blame expert / no expert.decision by design.
|
||||
if (
|
||||
request.type !== BlameRequestType.CAR_BODY &&
|
||||
!request.expert?.decision
|
||||
) {
|
||||
throw new BadRequestException(
|
||||
"Expert has not made a decision yet",
|
||||
);
|
||||
@@ -5832,9 +5836,11 @@ export class RequestManagementService {
|
||||
);
|
||||
|
||||
if (allAccepted) {
|
||||
// Both parties accepted - case is completed
|
||||
finalStatus = CaseStatus.COMPLETED;
|
||||
message = "Both parties have accepted. Case completed successfully.";
|
||||
message =
|
||||
updatedRequest.parties.length === 1
|
||||
? "Case completed successfully."
|
||||
: "Both parties have accepted. Case completed successfully.";
|
||||
|
||||
await this.blameRequestDbService.findByIdAndUpdate(requestId, {
|
||||
$set: {
|
||||
|
||||
Reference in New Issue
Block a user