forked from Yara724/api
Fixed YARA-1217
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user