@@ -37,7 +37,7 @@ use axum::{Extension, Json, Router};
3737use axum_extra:: headers:: authorization:: Bearer ;
3838use axum_extra:: headers:: Authorization ;
3939use axum_extra:: TypedHeader ;
40- use chrono:: { Datelike , Local } ;
40+ use chrono:: { DateTime , Datelike , Local } ;
4141use tokio:: net:: TcpListener ;
4242use tracing:: { info, instrument, trace, warn} ;
4343
@@ -147,6 +147,7 @@ struct VisitPath {
147147struct ScanPaths {
148148 visit : VisitPath ,
149149 subdirectory : Subdirectory ,
150+ timestamp : DateTime < Local > ,
150151}
151152
152153/// GraphQL type to provide current configuration for a beamline
@@ -301,6 +302,8 @@ impl FieldSource<ScanField> for ScanPaths {
301302 ScanField :: Subdirectory => self . subdirectory . to_string ( ) . into ( ) ,
302303 ScanField :: ScanNumber => self . visit . info . scan_number ( ) . to_string ( ) . into ( ) ,
303304 ScanField :: Beamline ( bl) => self . visit . resolve ( bl) ,
305+ ScanField :: YearMonthDay => self . timestamp . format ( "%Y%m%d" ) . to_string ( ) . into ( ) ,
306+ ScanField :: HourMinuteSecond => self . timestamp . format ( "%H%M%S" ) . to_string ( ) . into ( ) ,
304307 }
305308 }
306309}
@@ -427,6 +430,7 @@ impl Mutation {
427430 visit,
428431 info : next_scan,
429432 } ,
433+ timestamp : Local :: now ( ) ,
430434 subdirectory : sub. unwrap_or_default ( ) ,
431435 } )
432436 }
0 commit comments