fix(workflows): resolve QA blockers and protect case evidence

Fix registrar signing, reviewer re-entry, replacement evidence freshness, owner decision and rating races, multipart objections, vehicle serialization and product reporting.

Validate uploaded media with FFmpeg, serve evidence through expiring signed links, and add targeted regressions plus a dry-run repair for prematurely completed visit cases.
This commit is contained in:
SepehrYahyaee
2026-11-22 12:50:22 +03:30
parent abc40df199
commit 6b968c0952
37 changed files with 1118 additions and 211 deletions
+13 -2
View File
@@ -1,3 +1,4 @@
import { validateMedia } from "./validate-media";
import { BadRequestException, Injectable, Logger } from "@nestjs/common";
import { InjectModel } from "@nestjs/mongoose";
import { Model, Types } from "mongoose";
@@ -106,7 +107,7 @@ export class MediaPolicyService {
kind: MediaKind,
): Promise<void> {
const limits = await this.clientService.getMediaLimits(clientId, kind);
const violation = this.checkLimits(file, limits, kind);
const violation = this.checkLimits(file, limits, kind) ?? await this.contentViolation(file, kind);
if (!violation) return;
await this.tryDelete(file?.path);
@@ -133,7 +134,7 @@ export class MediaPolicyService {
const kind = fieldKindMap[field];
if (!kind) continue;
const limits = await getLimits(kind);
const violation = this.checkLimits(file, limits, kind, field);
const violation = this.checkLimits(file, limits, kind, field) ?? await this.contentViolation(file, kind);
if (!violation) continue;
// The request is being rejected — clean up all uploaded files so we
@@ -143,6 +144,16 @@ export class MediaPolicyService {
}
}
private async contentViolation(file: NonNullable<UploadedFileLike>, kind: MediaKind) {
try {
if (!file.path) throw new Error('Missing file');
await validateMedia(file.path, kind);
return null;
} catch {
return {code: 'MEDIA_CONTENT_INVALID', kind, message: 'محتوای فایل قابل خواندن نیست یا با نوع مدرک مطابقت ندارد. فایل سالم و مناسب را دوباره انتخاب کنید.'};
}
}
private checkLimits(
file: NonNullable<UploadedFileLike>,
{ minBytes, maxBytes }: MediaLimits,