forked from Yara724/api
Added AI damage helper
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { AiService } from "src/ai/ai.service";
|
||||
import { currentAiCaptures } from "src/ai/ai-captures";
|
||||
import { ClaimCaseDbService } from "src/claim-request-management/entites/db-service/claim-case.db.service";
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
@@ -64,6 +67,8 @@ export class SuperAdminController {
|
||||
private readonly superAdminService: SuperAdminService,
|
||||
private readonly systemSettingsService: SystemSettingsService,
|
||||
private readonly expertInsurerService: ExpertInsurerService,
|
||||
private readonly aiService: AiService,
|
||||
private readonly claimCaseDbService: ClaimCaseDbService,
|
||||
) {}
|
||||
|
||||
// ── Super-admin account management ───────────────────────────────────────
|
||||
@@ -428,6 +433,28 @@ export class SuperAdminController {
|
||||
return this.expertInsurerService.getFileTimeline(clientId, publicId);
|
||||
}
|
||||
|
||||
@Get("insurer/files/:publicId/ai-analysis")
|
||||
@ApiOperation({ summary: "AI analysis for a file of the selected client" })
|
||||
@ApiQuery({ name: "clientId", required: true, type: String })
|
||||
async getAiAnalysis(@Query("clientId") clientId: string, @Param("publicId") publicId: string) {
|
||||
const detail = await this.expertInsurerService.retrieveFileDetailsByPublicId(clientId, publicId);
|
||||
const id = typeof detail.claim?.claimRequestId === "string" ? detail.claim.claimRequestId : undefined;
|
||||
if (!id) return { enabled: this.aiService.enabled, images: [] };
|
||||
const claim = await this.claimCaseDbService.findById(id);
|
||||
return this.aiService.list(id, currentAiCaptures(claim));
|
||||
}
|
||||
|
||||
@Post("insurer/files/:publicId/ai-analysis/retry")
|
||||
@ApiOperation({ summary: "Retry failed AI analyses for the selected client's file" })
|
||||
@ApiQuery({ name: "clientId", required: true, type: String })
|
||||
async retryAiAnalysis(@Query("clientId") clientId: string, @Param("publicId") publicId: string) {
|
||||
const detail = await this.expertInsurerService.retrieveFileDetailsByPublicId(clientId, publicId);
|
||||
const id = typeof detail.claim?.claimRequestId === "string" ? detail.claim.claimRequestId : undefined;
|
||||
if (!id) return { enabled: this.aiService.enabled, images: [] };
|
||||
const claim = await this.claimCaseDbService.findById(id);
|
||||
return this.aiService.retry(id, currentAiCaptures(claim));
|
||||
}
|
||||
|
||||
@Get("insurer/files/:publicId")
|
||||
@ApiOperation({ summary: "File details by publicId for a given client" })
|
||||
@ApiParam({ name: "publicId" })
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { AiModule } from "src/ai/ai.module";
|
||||
import { ClaimRequestManagementModule } from "src/claim-request-management/claim-request-management.module";
|
||||
import { Module } from "@nestjs/common";
|
||||
import { ClientModule } from "src/client/client.module";
|
||||
import { SystemSettingsModule } from "src/system-settings/system-settings.module";
|
||||
@@ -23,6 +25,8 @@ import { SuperAdminGuard } from "./guards/super-admin.guard";
|
||||
*/
|
||||
@Module({
|
||||
imports: [
|
||||
AiModule,
|
||||
ClaimRequestManagementModule,
|
||||
ClientModule,
|
||||
SystemSettingsModule,
|
||||
HashModule,
|
||||
|
||||
Reference in New Issue
Block a user