1
1
import { Parent , Query , ResolveField , Resolver } from '@nestjs/graphql' ;
2
- import { Loader , type LoaderOf } from '@seedcompany/data-loader' ;
3
2
import { stripIndent } from 'common-tags' ;
4
- import { type ParentIdMiddlewareAdditions , viewOfChangeset } from '~/common' ;
3
+ import { Grandparent } from '~/common' ;
5
4
import { SerializedWorkflow } from '../../../workflow/dto' ;
6
- import { SecuredProjectStep } from '../../dto' ;
7
- import { ProjectLoader } from '../../project.loader' ;
5
+ import { type Project , SecuredProjectStep } from '../../dto' ;
8
6
import { ProjectWorkflowTransition } from '../dto' ;
9
7
import { ProjectWorkflowService } from '../project-workflow.service' ;
10
8
@@ -22,16 +20,12 @@ export class ProjectTransitionsResolver {
22
20
'The transitions currently available to execute for this project' ,
23
21
} )
24
22
async transitions (
25
- @Parent ( ) status : SecuredProjectStep & ParentIdMiddlewareAdditions ,
26
- @Loader ( ProjectLoader ) projects : LoaderOf < ProjectLoader > ,
23
+ @Grandparent ( ) project : Project ,
24
+ @Parent ( ) status : SecuredProjectStep ,
27
25
) : Promise < readonly ProjectWorkflowTransition [ ] > {
28
26
if ( ! status . canRead || ! status . value ) {
29
27
return [ ] ;
30
28
}
31
- const project = await projects . load ( {
32
- id : status . parentId ,
33
- view : viewOfChangeset ( status . changeset ) ,
34
- } ) ;
35
29
return await this . workflow . getAvailableTransitions ( project ) ;
36
30
}
37
31
0 commit comments