message:`Your amendment for the ${amendment.report.reportDate.toISOString().split('T')[0]} report was ${dto.decision.toLowerCase()}.${dto.notes?` Notes: ${dto.notes}`:''}`,
actionUrl:'/reports',
entityType:'reportAmendment',
entityId:amendmentId,
});
}catch{/* non-critical */}
this.logger.log(`Amendment ${amendmentId}${dto.decision} by ${currentUser.email}`);
message:`A report by ${report.user?.firstName||'contractor'}for${report.reportDate.toISOString().split('T')[0]}wasflaggedasinconsistent.Investigationmayberequired.`,
constamount=Math.round(salary*0.05);// 5% of monthly salary
awaitthis.prisma.deduction.create({
data:{
userId,
category:'B',
subCategory:'B3',
violationDate:newDate(),
description:`Automatic deduction: ${vagueCount} reports flagged as vague/useless in ${now.toLocaleString('en-US',{month:'long',year:'numeric'})}. Per the deduction policy, 3+ vague reports in a single month triggers a Category B3 deduction of 5% of monthly salary.`,
amountPiasters:amount,
originalAmountPiasters:amount,
calculationBasis:`Category B3 — 5% of monthly salary (${salary} piasters). ${vagueCount} vague flags this month.`,
status:'PENDING_ACKNOWLEDGMENT',
initiatedById:null,
initiatedByRole:'SYSTEM',
payrollMonth:now.getMonth()+1,
payrollYear:now.getFullYear(),
},
});
// Notify contractor
try{
awaitthis.notificationsService.create({
userId,
type:'BLOCKING',
category:'DEDUCTION',
title:'Deduction: Vague Reports (B3)',
message:`You have ${vagueCount} reports flagged as vague this month. A Category B3 deduction has been initiated.`,
actionUrl:'/salary',
isBlocking:true,
entityType:'deduction',
});
}catch{/* non-critical */}
this.logger.warn(
`B3 deduction auto-created for ${user?.firstName}${user?.lastName}:${vagueCount}vagueflagsthismonth`,