forked from Yara724/api
Added required documents for blame, added 2 sms
This commit is contained in:
@@ -6,9 +6,16 @@ import { ExpertBlameController } from "./expert-blame.controller";
|
||||
import { ExpertBlameV2Controller } from "./expert-blame.v2.controller";
|
||||
import { ExpertBlameService } from "./expert-blame.service";
|
||||
import { RequestManagementModule } from "src/request-management/request-management.module";
|
||||
import { SmsOrchestrationModule } from "src/sms-orchestration/sms-orchestration.module";
|
||||
|
||||
@Module({
|
||||
imports: [UsersModule, ClientModule, RequestManagementModule, PlatesModule],
|
||||
imports: [
|
||||
UsersModule,
|
||||
ClientModule,
|
||||
RequestManagementModule,
|
||||
PlatesModule,
|
||||
SmsOrchestrationModule,
|
||||
],
|
||||
controllers: [ExpertBlameController, ExpertBlameV2Controller],
|
||||
providers: [ExpertBlameService],
|
||||
exports: [ExpertBlameService],
|
||||
|
||||
@@ -45,6 +45,7 @@ import { UserSignDbService } from "src/request-management/entities/db-service/si
|
||||
import { RequestManagementService } from "src/request-management/request-management.service";
|
||||
import { snapshotFromFieldExpert } from "src/helpers/expert-profile-snapshot";
|
||||
import { ExpertModel } from "src/users/entities/schema/expert.schema";
|
||||
import { SmsOrchestrationService } from "src/sms-orchestration/sms-orchestration.service";
|
||||
|
||||
interface CheckedRequestEntry {
|
||||
CheckedRequest?: {
|
||||
@@ -85,6 +86,7 @@ export class ExpertBlameService {
|
||||
private readonly blameDocumentDbService: BlameDocumentDbService,
|
||||
private readonly userSignDbService: UserSignDbService,
|
||||
private readonly requestManagementService: RequestManagementService,
|
||||
private readonly smsOrchestrationService: SmsOrchestrationService,
|
||||
) { }
|
||||
|
||||
/** Load immutable profile fields from `expert` for the acting field expert. */
|
||||
@@ -946,6 +948,23 @@ export class ExpertBlameService {
|
||||
// Update expert stats (reusing existing helper)
|
||||
await this.updateDamageExpertStats(actorDetail.sub, requestId, "checked");
|
||||
|
||||
if (request.type === BlameRequestType.THIRD_PARTY) {
|
||||
const phones = (request.parties || [])
|
||||
.map((p: any) => p?.person?.phoneNumber)
|
||||
.filter((p: unknown): p is string => typeof p === "string" && p.length > 0);
|
||||
const expertLastName =
|
||||
actorDetail?.fullName?.trim()?.split(/\s+/).pop() || "کارشناس";
|
||||
for (const phone of phones) {
|
||||
await this.smsOrchestrationService.sendThirdPartyExpertStartedReviewNotice(
|
||||
{
|
||||
receptor: phone,
|
||||
publicId: request.publicId,
|
||||
expertLastName,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return { _id: requestId, lock: true };
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) throw error;
|
||||
|
||||
Reference in New Issue
Block a user