Fixed YARA-1217

This commit is contained in:
SepehrYahyaee
2026-08-10 10:34:20 +03:30
parent 8e4c794d61
commit 210e96fcf1
4 changed files with 60 additions and 101 deletions

View File

@@ -10280,37 +10280,35 @@ export class RequestManagementService {
body: DescriptionV4Dto,
partyRole?: string,
) {
if (
body.accidentDate == null ||
body.accidentDate === ("" as any)
) {
throw new BadRequestException(
"accidentDate is required for V4 files.",
);
}
if (
!body.accidentTime ||
!String(body.accidentTime).trim()
) {
throw new BadRequestException(
"accidentTime is required for V4 files.",
);
}
const req = await this.blameRequestDbService.findById(requestId);
if (!req) throw new NotFoundException("Request not found");
await this.verifyExpertAccessForBlameV2(req, actor);
const role = this.resolvePartyRoleV3(req, partyRole);
this.assertBlameV3PartyDetailPhase(req, role);
// accidentDate and accidentTime are only required for the first (guilty)
// party — the second (damaged) party can skip them.
if (role === PartyRole.FIRST) {
if (body.accidentDate == null || body.accidentDate === ("" as any)) {
throw new BadRequestException(
"accidentDate is required for the first party in V4 files.",
);
}
if (!body.accidentTime || !String(body.accidentTime).trim()) {
throw new BadRequestException(
"accidentTime is required for the first party in V4 files.",
);
}
}
const idx = this.getPartyIndex(req, role);
if (idx === -1) throw new BadRequestException(`${role} party not found`);
const party = req.parties[idx];
if (!party.statement) party.statement = {} as any;
party.statement.description = body.desc;
party.statement.accidentDate = body.accidentDate as any;
party.statement.accidentTime = body.accidentTime;
if (body.accidentDate != null) party.statement.accidentDate = body.accidentDate as any;
if (body.accidentTime) party.statement.accidentTime = body.accidentTime;
if (!Array.isArray(req.history)) req.history = [];
req.history.push({