@@ -314,9 +314,9 @@ impl CurrentConfiguration {
314314}
315315
316316#[ derive( Debug , InputObject ) ]
317- struct TemplateInput {
317+ struct NamedTemplateInput {
318318 name : String ,
319- template : String ,
319+ template : InputTemplate < ScanTemplate > ,
320320}
321321
322322#[ derive( Debug , Display , Error ) ]
@@ -421,17 +421,17 @@ impl Query {
421421 async fn named_templates < ' ctx > (
422422 & self ,
423423 ctx : & Context < ' ctx > ,
424- beamline : String ,
424+ instrument : String ,
425425 names : Option < Vec < String > > ,
426426 ) -> async_graphql:: Result < Vec < NamedTemplate > > {
427427 check_auth ( ctx, |policy, token| {
428- policy. check_instrument_admin ( token, & beamline )
428+ policy. check_instrument_admin ( token, & instrument )
429429 } )
430430 . await ?;
431431 let db = ctx. data :: < SqliteScanPathService > ( ) ?;
432432 match names {
433- Some ( names) => Ok ( db. additional_templates ( & beamline , names) . await ?) ,
434- None => Ok ( db. all_additional_templates ( & beamline ) . await ?) ,
433+ Some ( names) => Ok ( db. additional_templates ( & instrument , names) . await ?) ,
434+ None => Ok ( db. all_additional_templates ( & instrument ) . await ?) ,
435435 }
436436 }
437437}
@@ -530,13 +530,16 @@ impl Mutation {
530530 async fn register_template < ' ctx > (
531531 & self ,
532532 ctx : & Context < ' ctx > ,
533- beamline : String ,
534- template : TemplateInput ,
533+ instrument : String ,
534+ template : NamedTemplateInput ,
535535 ) -> async_graphql:: Result < NamedTemplate > {
536- check_auth ( ctx, |pc, token| pc. check_instrument_admin ( token, & beamline) ) . await ?;
536+ check_auth ( ctx, |pc, token| {
537+ pc. check_instrument_admin ( token, & instrument)
538+ } )
539+ . await ?;
537540 let db = ctx. data :: < SqliteScanPathService > ( ) ?;
538541 Ok ( db
539- . register_template ( & beamline , template. name , template. template )
542+ . register_template ( & instrument , template. name , template. template . to_string ( ) )
540543 . await ?)
541544 }
542545}
0 commit comments