@@ -8,11 +8,11 @@ use crate::declarations::_helpers::job_detail::{
88 critical_nodes, groups_running, members_in_order, shown_settings,
99} ;
1010use crate :: declarations:: main:: frozen_definitions:: frozen_definitions;
11- use crate :: declarations:: models:: JobDetailRecord ;
11+ use crate :: declarations:: models:: { JobDetailRecord , StoredJob } ;
1212use crate :: runs:: models:: RunKind ;
1313use crate :: snapshots:: main:: read_snapshot_nodes:: read_snapshot_nodes;
1414use crate :: store:: errors:: ControlError ;
15- use crate :: store:: main:: { begin:: begin, commit:: commit, query :: query } ;
15+ use crate :: store:: main:: { begin:: begin, commit:: commit, query_records :: query_records } ;
1616use crate :: store:: models:: { ControlStore , ControlTransaction , Parameter , TransactionMode } ;
1717
1818/// `None` when the target publishes no job by that name; refusal comes first either way.
@@ -70,20 +70,16 @@ async fn published_snapshot(
7070 transaction : ControlTransaction ,
7171 ( location_id, target, job_key) : ( Uuid , & str , & str ) ,
7272) -> Result < ( ControlTransaction , Option < Uuid > ) , ControlError > {
73- let ( transaction, rows ) = query (
73+ let ( transaction, stored ) : ( _ , Vec < StoredJob > ) = query_records (
7474 transaction,
75- "SELECT snapshot_id FROM sqb_jobs WHERE location_id=$1 AND target=$2 AND job_key=$3" ,
75+ "SELECT job_key, kind, snapshot_id, definition_json FROM sqb_jobs \
76+ WHERE location_id=$1 AND target=$2 AND job_key=$3",
7677 vec ! [
7778 Parameter :: Id ( location_id) ,
7879 Parameter :: Text ( target. into( ) ) ,
7980 Parameter :: Text ( job_key. into( ) ) ,
8081 ] ,
8182 )
8283 . await ?;
83- let snapshot_id = rows
84- . first ( )
85- . map ( |row| serde_json:: from_value ( row[ "snapshot_id" ] . clone ( ) ) )
86- . transpose ( )
87- . map_err ( |error| ControlError :: Invalid ( error. to_string ( ) ) ) ?;
88- Ok ( ( transaction, snapshot_id) )
84+ Ok ( ( transaction, stored. first ( ) . map ( |job| job. snapshot_id ) ) )
8985}
0 commit comments