@@ -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 create;
@@ -37,7 +38,7 @@ impl DeploymentMutation {
3738
3839 pause:: run ( & ctx, & deployment) ?;
3940
40- Ok ( EmptyResponse :: new ( None ) )
41+ Ok ( EmptyResponse :: new ( ) )
4142 }
4243
4344 /// Resumes a deployment that has been previously paused.
@@ -51,7 +52,7 @@ impl DeploymentMutation {
5152
5253 resume:: run ( & ctx, & deployment) ?;
5354
54- Ok ( EmptyResponse :: new ( None ) )
55+ Ok ( EmptyResponse :: new ( ) )
5556 }
5657
5758 /// Pauses a deployment and resumes it after a delay.
@@ -92,13 +93,16 @@ impl DeploymentMutation {
9293 & self ,
9394 ctx : & Context < ' _ > ,
9495 deployment : DeploymentSelector ,
95- ) -> Result < EmptyResponse > {
96+ ) -> Result < Response > {
9697 let ctx = GraphmanContext :: new ( ctx) ?;
9798 let deployment = deployment. try_into ( ) ?;
9899
99100 unassign:: run ( & ctx, & deployment) ?;
100101
101- Ok ( EmptyResponse :: new ( None ) )
102+ Ok ( Response :: new (
103+ true ,
104+ format ! ( "Unassigned {}" , deployment. as_str( ) ) ,
105+ ) )
102106 }
103107
104108 /// Assign or reassign a deployment
@@ -107,7 +111,7 @@ impl DeploymentMutation {
107111 ctx : & Context < ' _ > ,
108112 deployment : DeploymentSelector ,
109113 node : String ,
110- ) -> Result < EmptyResponse > {
114+ ) -> Result < Response > {
111115 let ctx = GraphmanContext :: new ( ctx) ?;
112116 let deployment = deployment. try_into ( ) ?;
113117 let node = NodeId :: new ( node. clone ( ) ) . map_err ( |( ) | anyhow ! ( "illegal node id `{}`" , node) ) ?;
@@ -116,9 +120,12 @@ impl DeploymentMutation {
116120 let mirror = catalog:: Mirror :: primary_only ( ctx. primary_pool ) ;
117121 let count = mirror. assignments ( & node) ?. len ( ) ;
118122 if count == 1 {
119- Ok ( EmptyResponse :: new ( Some ( format ! ( "warning: this is the only deployment assigned to '{}'. Are you sure it is spelled correctly?" , node. as_str( ) ) ) ) )
123+ Ok ( Response :: new ( true , format ! ( "warning: this is the only deployment assigned to '{}'. Are you sure it is spelled correctly?" , node. as_str( ) ) ) )
120124 } else {
121- Ok ( EmptyResponse :: new ( None ) )
125+ Ok ( Response :: new (
126+ true ,
127+ format ! ( "Ressigned {} to {}" , deployment. as_str( ) , node. as_str( ) ) ,
128+ ) )
122129 }
123130 }
124131}
0 commit comments