@@ -11,6 +11,7 @@ use graph_store_postgres::graphman::GraphmanStore;
1111use crate :: entities:: DeploymentSelector ;
1212use crate :: entities:: EmptyResponse ;
1313use crate :: entities:: ExecutionId ;
14+ use crate :: entities:: Response ;
1415use crate :: resolvers:: context:: GraphmanContext ;
1516
1617mod pause;
@@ -34,7 +35,7 @@ impl DeploymentMutation {
3435
3536 pause:: run ( & ctx, & deployment) ?;
3637
37- Ok ( EmptyResponse :: new ( None ) )
38+ Ok ( EmptyResponse :: new ( ) )
3839 }
3940
4041 /// Resumes a deployment that has been previously paused.
@@ -48,7 +49,7 @@ impl DeploymentMutation {
4849
4950 resume:: run ( & ctx, & deployment) ?;
5051
51- Ok ( EmptyResponse :: new ( None ) )
52+ Ok ( EmptyResponse :: new ( ) )
5253 }
5354
5455 /// Pauses a deployment and resumes it after a delay.
@@ -75,13 +76,16 @@ impl DeploymentMutation {
7576 & self ,
7677 ctx : & Context < ' _ > ,
7778 deployment : DeploymentSelector ,
78- ) -> Result < EmptyResponse > {
79+ ) -> Result < Response > {
7980 let ctx = GraphmanContext :: new ( ctx) ?;
8081 let deployment = deployment. try_into ( ) ?;
8182
8283 unassign:: run ( & ctx, & deployment) ?;
8384
84- Ok ( EmptyResponse :: new ( None ) )
85+ Ok ( Response :: new (
86+ true ,
87+ format ! ( "Unassigned {}" , deployment. as_str( ) ) ,
88+ ) )
8589 }
8690
8791 /// Assign or reassign a deployment
@@ -90,7 +94,7 @@ impl DeploymentMutation {
9094 ctx : & Context < ' _ > ,
9195 deployment : DeploymentSelector ,
9296 node : String ,
93- ) -> Result < EmptyResponse > {
97+ ) -> Result < Response > {
9498 let ctx = GraphmanContext :: new ( ctx) ?;
9599 let deployment = deployment. try_into ( ) ?;
96100 let node = NodeId :: new ( node. clone ( ) ) . map_err ( |( ) | anyhow ! ( "illegal node id `{}`" , node) ) ?;
@@ -99,9 +103,12 @@ impl DeploymentMutation {
99103 let mirror = catalog:: Mirror :: primary_only ( ctx. primary_pool ) ;
100104 let count = mirror. assignments ( & node) ?. len ( ) ;
101105 if count == 1 {
102- Ok ( EmptyResponse :: new ( Some ( format ! ( "warning: this is the only deployment assigned to '{}'. Are you sure it is spelled correctly?" , node. as_str( ) ) ) ) )
106+ Ok ( Response :: new ( true , format ! ( "warning: this is the only deployment assigned to '{}'. Are you sure it is spelled correctly?" , node. as_str( ) ) ) )
103107 } else {
104- Ok ( EmptyResponse :: new ( None ) )
108+ Ok ( Response :: new (
109+ true ,
110+ format ! ( "Ressigned {} to {}" , deployment. as_str( ) , node. as_str( ) ) ,
111+ ) )
105112 }
106113 }
107114}
0 commit comments