From f0ba8949cb2cadde980c11a75cc3568616865ecc Mon Sep 17 00:00:00 2001 From: SepehrYahyaee <7heycallmegray@gmail.com> Date: Mon, 18 May 2026 09:29:41 +0330 Subject: [PATCH] YARA-908 --- src/expert-claim/expert-claim.service.ts | 9 +++++++++ src/expert-claim/expert-claim.v2.controller.ts | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/expert-claim/expert-claim.service.ts b/src/expert-claim/expert-claim.service.ts index 6dff544..d912e2d 100644 --- a/src/expert-claim/expert-claim.service.ts +++ b/src/expert-claim/expert-claim.service.ts @@ -2304,6 +2304,15 @@ export class ExpertClaimService { return await this.branchDbService.findAll(insuranceId); } + /** + * V2: branches for the damage expert's insurer tenant (JWT `clientKey`). + * Same data as v1 `GET expert-claim/branches/:insuranceId` without passing client id. + */ + async retrieveInsuranceBranchesV2(actor: { clientKey?: string }) { + const clientKey = requireActorClientKey(actor); + return await this.branchDbService.findAll(clientKey); + } + private globalErrHandler(error) { this.logger.error(error.response?.responseCode, error.response); throw new HttpException(error.response, error.claimStatus); diff --git a/src/expert-claim/expert-claim.v2.controller.ts b/src/expert-claim/expert-claim.v2.controller.ts index d6bce6d..3f62add 100644 --- a/src/expert-claim/expert-claim.v2.controller.ts +++ b/src/expert-claim/expert-claim.v2.controller.ts @@ -71,6 +71,22 @@ export class ExpertClaimV2Controller { return this.claimRequestManagementService.getOuterPartsCatalogV2(carType); } + @Get("branches") + @ApiOperation({ + summary: "List insurer branches for this damage expert (V2)", + description: + "Returns branches for the insurance company bound to the expert JWT (`clientKey`). " + + "Same payload as v1 `GET expert-claim/branches/:insuranceId` — no client id in the URL.", + }) + @ApiResponse({ + status: 200, + description: + "Branch list (name, code, address, city, state, phoneNumber, isActive, …) for daghi / branch selection in expert replies", + }) + async getInsuranceBranchesV2(@CurrentUser() actor: { clientKey?: string }) { + return await this.expertClaimService.retrieveInsuranceBranchesV2(actor); + } + @Get("requests") @ApiOperation({ summary: "List available claim requests for damage expert",