File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
type ID ,
15
15
IdArg ,
16
16
IdField ,
17
+ InputException ,
17
18
IsOnly ,
18
19
ListArg ,
19
20
mapSecuredValue ,
@@ -63,6 +64,7 @@ import {
63
64
ProjectListInput ,
64
65
ProjectListOutput ,
65
66
ProjectType ,
67
+ TranslationProject ,
66
68
TranslationProjectListOutput ,
67
69
UpdateProjectInput ,
68
70
UpdateProjectOutput ,
@@ -106,6 +108,20 @@ export class ProjectResolver {
106
108
return await projects . load ( key ) ;
107
109
}
108
110
111
+ @Query ( ( ) => TranslationProject , {
112
+ description : 'Look up a translation project by its ID' ,
113
+ } )
114
+ async translationProject (
115
+ @Loader ( ProjectLoader ) projects : LoaderOf < ProjectLoader > ,
116
+ @IdsAndViewArg ( ) key : IdsAndView ,
117
+ ) : Promise < TranslationProject > {
118
+ const project = await projects . load ( key ) ;
119
+ if ( project . type === ProjectType . Internship ) {
120
+ throw new InputException ( 'Project is not a translation project' ) ;
121
+ }
122
+ return project ;
123
+ }
124
+
109
125
@Query ( ( ) => ProjectListOutput , {
110
126
description : 'Look up projects' ,
111
127
} )
You can’t perform that action at this time.
0 commit comments