Fixed GET users

This commit is contained in:
2026-06-18 18:15:20 +03:30
parent d8f7766f10
commit dcc3ee71de
11 changed files with 368 additions and 103 deletions

View File

@@ -437,9 +437,9 @@ export class ExpertBlameService {
}
/**
* Blame review inbox for FIELD_EXPERT — expert-initiated DISAGREEMENT files.
* Covers LINK flows (parties complete via link → WAITING_FOR_EXPERT) and in-progress
* disputes while parties are still filling. IN_PERSON AGREED blames use expert-claim instead.
* Blame inbox for FIELD_EXPERT — all expert-initiated blame files they created
* (LINK disputes, IN_PERSON, in-progress and completed). Claim work is usually
* via expert-claim after blame completion.
*/
private async getFieldExpertBlameListV2(
actor: { sub: string },
@@ -452,23 +452,6 @@ export class ExpertBlameService {
{
expertInitiated: true,
initiatedByFieldExpertId: expertOid,
blameStatus: BlameStatus.DISAGREEMENT,
type: { $ne: BlameRequestType.CAR_BODY },
$or: [
{ status: CaseStatus.WAITING_FOR_EXPERT },
{
status: {
$in: [
CaseStatus.OPEN,
CaseStatus.WAITING_FOR_SECOND_PARTY,
CaseStatus.WAITING_FOR_DOCUMENT_RESEND,
],
},
},
{ "workflow.lockedBy.actorId": expertOid },
{ "workflow.assignedForReviewBy.actorId": expertOid },
{ "expert.decision.decidedByExpertId": expertOid },
],
},
{ lean: true },
)) as Record<string, unknown>[];
@@ -967,7 +950,12 @@ export class ExpertBlameService {
// Tenant check
assertBlameCaseForExpertTenant(doc, actor);
if (doc.type === BlameRequestType.CAR_BODY) {
const isFieldExpertOwner = blameCaseInitiatedByFieldExpert(doc, actor);
if (
doc.type === BlameRequestType.CAR_BODY &&
!isFieldExpertOwner
) {
throw new ForbiddenException(
"CAR_BODY type requests are automatically handled and do not require expert review.",
);
@@ -984,8 +972,6 @@ export class ExpertBlameService {
);
}
const isFieldExpertOwner = blameCaseInitiatedByFieldExpert(doc, actor);
const decision = (doc.expert as any)?.decision;
const decidedByExpertId = decision?.decidedByExpertId
? String(decision.decidedByExpertId)