1
- import { Injectable } from '@nestjs/common' ;
1
+ import { forwardRef , Inject , Injectable } from '@nestjs/common' ;
2
2
import { ModuleRef } from '@nestjs/core' ;
3
3
import { ID , Session , UnsecuredDto } from '~/common' ;
4
- import { IEventBus , ResourceLoader } from '~/core' ;
5
4
import {
6
5
findTransition ,
7
6
WorkflowService ,
8
7
} from '../../workflow/workflow.service' ;
9
8
import { Engagement , EngagementStatus } from '../dto' ;
9
+ import { EngagementService } from '../engagement.service' ;
10
10
import {
11
11
ExecuteEngagementTransitionInput ,
12
12
EngagementWorkflowEvent as WorkflowEvent ,
@@ -19,9 +19,9 @@ export class EngagementWorkflowService extends WorkflowService(
19
19
( ) => EngagementWorkflow ,
20
20
) {
21
21
constructor (
22
- private readonly resources : ResourceLoader ,
22
+ @Inject ( forwardRef ( ( ) => EngagementService ) )
23
+ private readonly engagements : EngagementService & { } ,
23
24
private readonly repo : EngagementWorkflowRepository ,
24
- private readonly eventBus : IEventBus ,
25
25
private readonly moduleRef : ModuleRef ,
26
26
) {
27
27
super ( ) ;
@@ -73,13 +73,7 @@ export class EngagementWorkflowService extends WorkflowService(
73
73
) {
74
74
const { engagement : engagementId , notes } = input ;
75
75
76
- const { EngagementLoader } = await import ( '../engagement.loader' ) ;
77
- const engagements = await this . resources . getLoader ( EngagementLoader ) ;
78
- const loaderKey = {
79
- id : engagementId ,
80
- view : { active : true } ,
81
- } as const ;
82
- const previous = await engagements . load ( loaderKey ) ;
76
+ const previous = await this . engagements . readOne ( engagementId , session ) ;
83
77
84
78
const next =
85
79
this . getBypassIfValid ( input , session ) ??
@@ -99,8 +93,7 @@ export class EngagementWorkflowService extends WorkflowService(
99
93
session ,
100
94
) ;
101
95
102
- engagements . clear ( loaderKey ) ;
103
- return await engagements . load ( loaderKey ) ;
96
+ return await this . engagements . readOne ( engagementId , session ) ;
104
97
}
105
98
106
99
/** @deprecated */
0 commit comments