Enforce claim beneficiary access and retire unused legacy APIs

This commit is contained in:
SepehrYahyaee
2026-10-05 14:39:51 +03:30
parent 0735333467
commit a3f9aab8fb
104 changed files with 6864 additions and 13223 deletions
@@ -1,19 +0,0 @@
import { ApiProperty } from "@nestjs/swagger";
/**
* Computed on GET blame v2 for the current viewer — no DB field on BlameRequest.
*/
export class ClaimCreationHintDto {
@ApiProperty({
description:
"True if a v2 claim case already exists for this blame (by blameRequestId).",
})
hasClaim: boolean;
@ApiProperty({
description:
"True when this viewer is the damaged party, blame is COMPLETED, no claim exists yet, " +
"and for THIRD_PARTY all parties have signed and accepted the expert decision.",
})
shouldGuideToCreateClaim: boolean;
}
@@ -1,29 +0,0 @@
import { ApiProperty } from "@nestjs/swagger";
import { AddPlateDto } from "src/profile/dto/user/AddPlateDto";
import { DescriptionDto } from "./create-request-management.dto";
import { InitialFormDto, CarBodyFormDto } from "./create-request-management.dto";
/**
* Comprehensive form for experts to fill all information at once for IN_PERSON CAR_BODY files
*/
export class ExpertCompleteCarBodyFormDto {
// First Party Information
@ApiProperty({
description: "First party phone number",
example: "09123456789",
})
firstPartyPhoneNumber: string;
@ApiProperty({ type: InitialFormDto })
firstPartyInitialForm: InitialFormDto;
@ApiProperty({ type: CarBodyFormDto })
carBodyForm: CarBodyFormDto;
@ApiProperty({ type: AddPlateDto })
firstPartyPlate: AddPlateDto;
@ApiProperty({ type: DescriptionDto })
firstPartyDescription: DescriptionDto;
}
@@ -1,11 +0,0 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { LocationDto } from "./create-request-management.dto";
export class ExpertCompleteLocationsDto {
@ApiProperty({ type: LocationDto })
firstPartyLocation: LocationDto;
@ApiPropertyOptional({ type: LocationDto })
secondPartyLocation?: LocationDto;
}
@@ -1,57 +0,0 @@
import { ApiProperty } from "@nestjs/swagger";
import { AddPlateDto } from "src/profile/dto/user/AddPlateDto";
import { DescriptionDto } from "./create-request-management.dto";
import { InitialFormDto } from "./create-request-management.dto";
/**
* Second party information for expert-completed THIRD_PARTY forms
*/
export class ExpertSecondPartyInfoDto {
@ApiProperty({
description: "Second party phone number",
example: "09123456789",
})
phoneNumber: string;
@ApiProperty({ type: InitialFormDto })
initialForm: InitialFormDto;
@ApiProperty({ type: AddPlateDto })
plate: AddPlateDto;
@ApiProperty({ type: DescriptionDto })
description: DescriptionDto;
}
/**
* Comprehensive form for experts to fill all information at once for IN_PERSON THIRD_PARTY files
*/
export class ExpertCompleteThirdPartyFormDto {
// First Party Information
@ApiProperty({
description: "First party phone number",
example: "09123456789",
})
firstPartyPhoneNumber: string;
@ApiProperty({ type: InitialFormDto })
firstPartyInitialForm: InitialFormDto;
@ApiProperty({ type: AddPlateDto })
firstPartyPlate: AddPlateDto;
@ApiProperty({ type: DescriptionDto })
firstPartyDescription: DescriptionDto;
// Second Party Information
@ApiProperty({ type: ExpertSecondPartyInfoDto })
secondParty: ExpertSecondPartyInfoDto;
// Guilty Party
@ApiProperty({
description: "Phone number of the guilty party. Must match either first or second party phone number.",
example: "09123456789",
})
guiltyPartyPhoneNumber: string;
}
@@ -1,52 +0,0 @@
import { ApiProperty } from "@nestjs/swagger";
import { RequestManagementModel } from "../entities/schema/request-management.schema";
export class UserReplyDto {
public _id: string;
@ApiProperty({ required: true })
isAccept: boolean;
@ApiProperty({ required: true })
signId: string;
constructor(requestId: string) {
this._id = requestId;
}
}
export class DetailsReplyDtoRs {
public fields: Object;
public actorFullName: string;
public description: string;
public dateOfReply: string;
public timeOfReply: string;
public isGuiltyUser: boolean;
public firstPartyAccept: boolean;
public secondPartyAccept: boolean;
public status: string;
public expertResendReply: any;
public expertSubmitReply: any;
public expertSubmitReplyFinal: any;
public theParties: any;
public type: string;
constructor(request: RequestManagementModel, details: any) {
const finalReply = request.expertSubmitReply;
this.fields = finalReply.fields;
this.description = finalReply.description;
this.firstPartyAccept = finalReply?.firstPartyComment?.isAccept;
this.secondPartyAccept = finalReply?.secondPartyComment?.isAccept;
this.actorFullName = details.actorDetail.CheckedRequest.fullName;
this.dateOfReply = details.actorDetail.Date.toLocaleDateString("fa-IR");
this.timeOfReply = details.actorDetail.Date.toLocaleTimeString("fa-IR");
this.isGuiltyUser = details.isGuilty;
this.status = request.blameStatus;
this.expertResendReply = request.expertResendReply;
this.expertSubmitReply = request.expertSubmitReply;
this.expertSubmitReplyFinal = request.expertSubmitReplyFinal;
this.theParties = details.theParties;
this.type = request.type || "THIRD_PARTY"; // Include type field
}
}