forked from Yara724/api
YARA-856
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
ApiBody,
|
||||
ApiOperation,
|
||||
ApiParam,
|
||||
ApiQuery,
|
||||
ApiTags,
|
||||
@@ -105,6 +106,11 @@ export class ExpertInsurerController {
|
||||
}
|
||||
|
||||
@Get("experts/top")
|
||||
@ApiOperation({
|
||||
summary: "Top blame vs claim experts for this insurer",
|
||||
description:
|
||||
"Response has two arrays: `blameExperts` (roster from expert / blame files) and `claimExperts` (damage-expert roster / claim files). Each item includes `overallAverageRating` derived from ratings stored on those files plus user ratings where present.",
|
||||
})
|
||||
async getTopExperts(@CurrentUser() actor) {
|
||||
return await this.expertInsurerService.getTopExpertsForClient(actor);
|
||||
}
|
||||
@@ -128,6 +134,78 @@ export class ExpertInsurerController {
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBody({
|
||||
description:
|
||||
"One insurer rating for the shared publicId; persisted on claim and/or blame case documents when both exist.",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
collisionMethodAccuracy: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 4,
|
||||
description: "تشخیص درست نحوه برخورد",
|
||||
},
|
||||
evaluationTimeliness: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 3,
|
||||
description: "زمان ارزیابی",
|
||||
},
|
||||
accidentCauseAccuracy: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 5,
|
||||
description: "تشخیص درست علت تصادف",
|
||||
},
|
||||
guiltyVehicleIdentification: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 4,
|
||||
description: "تشخیص درست وسیله نقلیه مقصر",
|
||||
},
|
||||
botRating: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 4,
|
||||
description: "برای امتیاز دادن به عملکرد بات",
|
||||
},
|
||||
},
|
||||
required: [
|
||||
"collisionMethodAccuracy",
|
||||
"evaluationTimeliness",
|
||||
"accidentCauseAccuracy",
|
||||
"guiltyVehicleIdentification",
|
||||
"botRating",
|
||||
],
|
||||
example: {
|
||||
collisionMethodAccuracy: 4,
|
||||
evaluationTimeliness: 3,
|
||||
accidentCauseAccuracy: 5,
|
||||
guiltyVehicleIdentification: 4,
|
||||
botRating: 4,
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiParam({ name: "publicId" })
|
||||
@Put("files/:publicId/rating")
|
||||
async rateExpertsByPublicId(
|
||||
@CurrentUser() insurer,
|
||||
@Param("publicId") publicId: string,
|
||||
@Body() rating: FileRating,
|
||||
) {
|
||||
return await this.expertInsurerService.rateExpertByPublicId(
|
||||
publicId,
|
||||
rating,
|
||||
insurer.clientKey,
|
||||
);
|
||||
}
|
||||
|
||||
@Get("top-files")
|
||||
async getTopFiles(@CurrentUser() insurer) {
|
||||
return await this.expertInsurerService.getTopFilesForClient(
|
||||
@@ -185,82 +263,4 @@ export class ExpertInsurerController {
|
||||
insurer.clientKey,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBody({
|
||||
description: "Detailed expert rating by insurer",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
collisionMethodAccuracy: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 4,
|
||||
description: "تشخیص درست نحوه برخورد",
|
||||
},
|
||||
evaluationTimeliness: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 3,
|
||||
description: "زمان ارزیابی",
|
||||
},
|
||||
accidentCauseAccuracy: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 5,
|
||||
description: "تشخیص درست علت تصادف",
|
||||
},
|
||||
guiltyVehicleIdentification: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 4,
|
||||
description: "تشخیص درست وسیله نقلیه مقصر",
|
||||
},
|
||||
botRating: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 5,
|
||||
example: 4,
|
||||
description: "برای امتیاز دادن به عملکرد بات",
|
||||
},
|
||||
},
|
||||
required: [
|
||||
"collisionMethodAccuracy",
|
||||
"evaluationTimeliness",
|
||||
"accidentCauseAccuracy",
|
||||
"guiltyVehicleIdentification",
|
||||
"botRating",
|
||||
],
|
||||
example: {
|
||||
collisionMethodAccuracy: 4,
|
||||
evaluationTimeliness: 3,
|
||||
accidentCauseAccuracy: 5,
|
||||
guiltyVehicleIdentification: 4,
|
||||
botRating: 4,
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiParam({ name: "requestId" })
|
||||
@ApiQuery({ name: "role", enum: ["claim", "blame"] })
|
||||
@Put("/:requestId/rating")
|
||||
async rateExperts(
|
||||
@CurrentUser() insurer,
|
||||
@Param("requestId") requestId: string,
|
||||
@Body() rating: FileRating,
|
||||
@Query("role") role: "claim" | "blame",
|
||||
) {
|
||||
if (!["claim", "blame"].includes(role)) {
|
||||
throw new BadRequestException("Invalid role");
|
||||
}
|
||||
|
||||
return await this.expertInsurerService.rateExpertOnFile(
|
||||
requestId,
|
||||
rating,
|
||||
role,
|
||||
insurer.clientKey,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user