Merge pull request 'Fixed v4/v5 flow' (#208) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#208
This commit is contained in:
2026-07-22 17:22:55 +03:30
3 changed files with 22 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsEnum, IsOptional, IsString } from "class-validator";
import { IsBoolean, IsEnum, IsOptional } from "class-validator";
import { CreationMethod } from "../entities/schema/request-management.schema";
export class CreateExpertInitiatedFileDto {
@@ -18,4 +18,17 @@ export class CreateExpertInitiatedFileDto {
})
@IsEnum(CreationMethod)
creationMethod: CreationMethod;
/**
* V5 only. When true the resulting claim will require FileMaker approval
* before fanavaran submission. V4 files must leave this unset (or false).
*/
@ApiPropertyOptional({
description:
"V5 only — when true the claim requires FileMaker approval before fanavaran submission.",
example: false,
})
@IsBoolean()
@IsOptional()
requiresFileMakerApproval?: boolean;
}

View File

@@ -88,7 +88,7 @@ export class FileMakerBlameV5Controller {
) {
return this.requestManagementService.createExpertInitiatedBlameV2(
fileMaker,
{ ...dto, creationMethod: CreationMethod.IN_PERSON },
{ ...dto, creationMethod: CreationMethod.IN_PERSON, requiresFileMakerApproval: true },
);
}

View File

@@ -4835,6 +4835,9 @@ export class RequestManagementService {
? FilledBy.EXPERT
: FilledBy.CUSTOMER,
...(isFileMakerRole ? { isMadeByFileMaker: true } : {}),
// V5 only: flag that causes the resulting claim to require FileMaker
// approval before fanavaran submission. V4 files never set this.
...(dto.requiresFileMakerApproval ? { requiresFileMakerApproval: true } : {}),
});
const requestId = String((created as any)._id);
@@ -8876,9 +8879,10 @@ export class RequestManagementService {
},
}
: {}),
// V5 (isMadeByFileMaker): mark approval gate at claim creation so the flag
// is always present regardless of whether upload-video is called.
...((req as any).isMadeByFileMaker
// V5 only: propagate the approval gate from the blame record to the claim.
// isMadeByFileMaker is true for both V4 and V5; only V5 blame records also
// carry requiresFileMakerApproval=true (set at create time by the V5 controller).
...((req as any).requiresFileMakerApproval
? {
requiresFileMakerApproval: true,
fileMakerApprovalActorId: new Types.ObjectId(actor.sub),