forked from Yara724/api
Fixed v4/v5 flow
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
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";
|
import { CreationMethod } from "../entities/schema/request-management.schema";
|
||||||
|
|
||||||
export class CreateExpertInitiatedFileDto {
|
export class CreateExpertInitiatedFileDto {
|
||||||
@@ -18,4 +18,17 @@ export class CreateExpertInitiatedFileDto {
|
|||||||
})
|
})
|
||||||
@IsEnum(CreationMethod)
|
@IsEnum(CreationMethod)
|
||||||
creationMethod: 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export class FileMakerBlameV5Controller {
|
|||||||
) {
|
) {
|
||||||
return this.requestManagementService.createExpertInitiatedBlameV2(
|
return this.requestManagementService.createExpertInitiatedBlameV2(
|
||||||
fileMaker,
|
fileMaker,
|
||||||
{ ...dto, creationMethod: CreationMethod.IN_PERSON },
|
{ ...dto, creationMethod: CreationMethod.IN_PERSON, requiresFileMakerApproval: true },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4835,6 +4835,9 @@ export class RequestManagementService {
|
|||||||
? FilledBy.EXPERT
|
? FilledBy.EXPERT
|
||||||
: FilledBy.CUSTOMER,
|
: FilledBy.CUSTOMER,
|
||||||
...(isFileMakerRole ? { isMadeByFileMaker: true } : {}),
|
...(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);
|
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
|
// V5 only: propagate the approval gate from the blame record to the claim.
|
||||||
// is always present regardless of whether upload-video is called.
|
// isMadeByFileMaker is true for both V4 and V5; only V5 blame records also
|
||||||
...((req as any).isMadeByFileMaker
|
// carry requiresFileMakerApproval=true (set at create time by the V5 controller).
|
||||||
|
...((req as any).requiresFileMakerApproval
|
||||||
? {
|
? {
|
||||||
requiresFileMakerApproval: true,
|
requiresFileMakerApproval: true,
|
||||||
fileMakerApprovalActorId: new Types.ObjectId(actor.sub),
|
fileMakerApprovalActorId: new Types.ObjectId(actor.sub),
|
||||||
|
|||||||
Reference in New Issue
Block a user