@@ -33,7 +33,7 @@ use axum::{Extension, Json, Router};
3333use axum_extra:: headers:: authorization:: Bearer ;
3434use axum_extra:: headers:: Authorization ;
3535use axum_extra:: TypedHeader ;
36- use chrono:: { Datelike , Local } ;
36+ use chrono:: { DateTime , Datelike , Local } ;
3737use derive_more:: { Display , Error } ;
3838use tokio:: net:: TcpListener ;
3939use tracing:: { debug, info, instrument, trace, warn} ;
@@ -145,6 +145,7 @@ struct DirectoryPath {
145145struct ScanPaths {
146146 directory : DirectoryPath ,
147147 subdirectory : Subdirectory ,
148+ timestamp : DateTime < Local > ,
148149}
149150
150151/// GraphQL type to provide current configuration for an instrument
@@ -308,6 +309,8 @@ impl FieldSource<ScanField> for ScanPaths {
308309 ScanField :: Subdirectory => self . subdirectory . to_string ( ) . into ( ) ,
309310 ScanField :: ScanNumber => self . directory . info . scan_number ( ) . to_string ( ) . into ( ) ,
310311 ScanField :: Directory ( dir) => self . directory . resolve ( dir) ,
312+ ScanField :: YearMonthDay => self . timestamp . format ( "%Y%m%d" ) . to_string ( ) . into ( ) ,
313+ ScanField :: HourMinuteSecond => self . timestamp . format ( "%H%M%S" ) . to_string ( ) . into ( ) ,
311314 }
312315 }
313316}
@@ -425,6 +428,7 @@ impl Mutation {
425428 instrument_session,
426429 info : next_scan,
427430 } ,
431+ timestamp : Local :: now ( ) ,
428432 subdirectory : sub. unwrap_or_default ( ) ,
429433 } )
430434 }
0 commit comments