1
0
forked from Yara724/api
This commit is contained in:
SepehrYahyaee
2026-06-03 12:05:19 +03:30
parent 077bae429e
commit 2c810afcb6
4 changed files with 121 additions and 25 deletions

View File

@@ -10,7 +10,14 @@ import {
Query,
UseGuards,
} from "@nestjs/common";
import { ApiBearerAuth, ApiBody, ApiOperation, ApiParam, ApiResponse, ApiTags } from "@nestjs/swagger";
import {
ApiBearerAuth,
ApiBody,
ApiOperation,
ApiParam,
ApiResponse,
ApiTags,
} from "@nestjs/swagger";
import { ExpertFileAssignResultDto } from "src/common/dto/expert-file-assign-result.dto";
import { LocalActorAuthGuard } from "src/auth/guards/actor-local.guard";
import { RolesGuard } from "src/auth/guards/role.guard";
@@ -29,7 +36,7 @@ import { ResendRequestDto } from "./dto/resend.dto";
@UseGuards(LocalActorAuthGuard, RolesGuard)
@Roles(RoleEnum.EXPERT, RoleEnum.FIELD_EXPERT)
export class ExpertBlameV2Controller {
constructor(private readonly expertBlameService: ExpertBlameService) { }
constructor(private readonly expertBlameService: ExpertBlameService) {}
@Get()
@ApiOperation({
@@ -63,7 +70,9 @@ export class ExpertBlameV2Controller {
} catch (error) {
if (error instanceof HttpException) throw error;
throw new InternalServerErrorException(
error instanceof Error ? error.message : "Failed to load blame status report",
error instanceof Error
? error.message
: "Failed to load blame status report",
);
}
}
@@ -76,7 +85,9 @@ export class ExpertBlameV2Controller {
} catch (error) {
if (error instanceof HttpException) throw error;
throw new InternalServerErrorException(
error instanceof Error ? error.message : "Failed to get blame case details",
error instanceof Error
? error.message
: "Failed to get blame case details",
);
}
}
@@ -96,7 +107,10 @@ export class ExpertBlameV2Controller {
})
async assignForReview(@Param("id") id: string, @CurrentUser() actor: any) {
try {
return await this.expertBlameService.assignBlameCaseForReviewV2(id, actor);
return await this.expertBlameService.assignBlameCaseForReviewV2(
id,
actor,
);
} catch (error) {
if (error instanceof HttpException) throw error;
throw new InternalServerErrorException(
@@ -110,6 +124,7 @@ export class ExpertBlameV2Controller {
summary: "Lock blame case for review (legacy)",
description:
"Same assignment logic as POST `:id/assign`, but returns the legacy `{ _id, lock }` shape and maps conflicts to 400 instead of 409.",
deprecated: true,
})
@ApiParam({ name: "id", description: "Blame case request id" })
async lockRequest(@Param("id") id: string, @CurrentUser() actor: any) {
@@ -156,7 +171,9 @@ export class ExpertBlameV2Controller {
} catch (error) {
if (error instanceof HttpException) throw error;
throw new InternalServerErrorException(
error instanceof Error ? error.message : "Failed to submit expert reply",
error instanceof Error
? error.message
: "Failed to submit expert reply",
);
}
}
@@ -174,7 +191,9 @@ export class ExpertBlameV2Controller {
} catch (error) {
if (error instanceof HttpException) throw error;
throw new InternalServerErrorException(
error instanceof Error ? error.message : "Failed to submit expert reply for in person",
error instanceof Error
? error.message
: "Failed to submit expert reply for in person",
);
}
}