mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 22:25:42 +00:00
add yard distances management to rule engine
- Introduced new yard distances resource with CRUD operations. - Created migration for yard distances table with necessary constraints. - Implemented service and repository for yard distances handling. - Added controller for API endpoints to manage yard distances. - Updated rule engine configuration to include yard distances. - Enhanced rule engine resource page to support yard distance selection. - Updated contracts and train builder pages to handle new yard distance logic. - Added error handling utility for better error message extraction.
This commit is contained in:
@@ -368,6 +368,25 @@ export class ContractsRepository extends BaseRepository<Contract> {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send-back reset: every step at or after `fromStepOrder` returns to PENDING
|
||||
* with its actor/verdict cleared, so the chain re-runs from that stage. The
|
||||
* send-back reason lives in the review-note trail, not on the wiped steps.
|
||||
*/
|
||||
async resetApprovalStepsFrom(
|
||||
contractId: string,
|
||||
fromStepOrder: number,
|
||||
): Promise<void> {
|
||||
await this.dataSource
|
||||
.getRepository(ContractApprovalStep)
|
||||
.createQueryBuilder()
|
||||
.update()
|
||||
.set({ status: 'PENDING', actedByStaffId: null, actedAt: null, note: null })
|
||||
.where('contract_id = :contractId', { contractId })
|
||||
.andWhere('step_order >= :fromStepOrder', { fromStepOrder })
|
||||
.execute();
|
||||
}
|
||||
|
||||
/** Check if all approval steps are approved. */
|
||||
async allApprovalStepsComplete(contractId: string): Promise<boolean> {
|
||||
const pending = await this.dataSource.getRepository(ContractApprovalStep).count({
|
||||
|
||||
Reference in New Issue
Block a user