1
0
forked from Yara724/api
This commit is contained in:
2026-04-30 10:32:53 +03:30
parent 715a9f2467
commit bffb8a3b97
2 changed files with 77 additions and 41 deletions

View File

@@ -242,24 +242,19 @@ export class ExpertInsurerController {
}
@ApiParam({ name: "expertId" })
@ApiQuery({ name: "role", enum: ["claim", "blame"] })
@ApiOperation({
summary: "Files handled by one roster expert (summary rows)",
description:
"Resolves id against this insurer's `expert` then `damage-expert` roster. Blame branch runs when the id is on the expert roster (field experts). Each item is a small summary (`kind`, ids, statuses, dates)—not full file payloads. Claim matches use final or draft damage-expert reply.",
})
@Get("/:expertId")
async requestDetail(
@CurrentUser() insurer,
@Param("expertId") id: string,
@Query("role") role: "claim" | "blame",
) {
if (!Types.ObjectId.isValid(new Types.ObjectId(id))) {
async requestDetail(@CurrentUser() insurer, @Param("expertId") id: string) {
if (!Types.ObjectId.isValid(id)) {
throw new BadRequestException("Invalid expert ID");
}
if (!["claim", "blame"].includes(role)) {
throw new BadRequestException("Invalid role");
}
return await this.expertInsurerService.getAllFilesByExpertAndRole(
return await this.expertInsurerService.getAllFilesForInsurerExpert(
id,
role,
insurer.clientKey,
);
}