@@ -314,9 +314,9 @@ impl CurrentConfiguration {
314
314
}
315
315
316
316
#[ derive( Debug , InputObject ) ]
317
- struct TemplateInput {
317
+ struct NamedTemplateInput {
318
318
name : String ,
319
- template : String ,
319
+ template : InputTemplate < ScanTemplate > ,
320
320
}
321
321
322
322
#[ derive( Debug , Display , Error ) ]
@@ -421,17 +421,17 @@ impl Query {
421
421
async fn named_templates < ' ctx > (
422
422
& self ,
423
423
ctx : & Context < ' ctx > ,
424
- beamline : String ,
424
+ instrument : String ,
425
425
names : Option < Vec < String > > ,
426
426
) -> async_graphql:: Result < Vec < NamedTemplate > > {
427
427
check_auth ( ctx, |policy, token| {
428
- policy. check_instrument_admin ( token, & beamline )
428
+ policy. check_instrument_admin ( token, & instrument )
429
429
} )
430
430
. await ?;
431
431
let db = ctx. data :: < SqliteScanPathService > ( ) ?;
432
432
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 ?) ,
435
435
}
436
436
}
437
437
}
@@ -530,13 +530,16 @@ impl Mutation {
530
530
async fn register_template < ' ctx > (
531
531
& self ,
532
532
ctx : & Context < ' ctx > ,
533
- beamline : String ,
534
- template : TemplateInput ,
533
+ instrument : String ,
534
+ template : NamedTemplateInput ,
535
535
) -> 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 ?;
537
540
let db = ctx. data :: < SqliteScanPathService > ( ) ?;
538
541
Ok ( db
539
- . register_template ( & beamline , template. name , template. template )
542
+ . register_template ( & instrument , template. name , template. template . to_string ( ) )
540
543
. await ?)
541
544
}
542
545
}
0 commit comments