@@ -82,10 +82,13 @@ public function getServices(Request $request, Response $response, array $args =
82
82
return $ response ->withJson ($ uniqueServices );
83
83
}
84
84
85
-
86
- public function deployments_r1 (Request $ request , Response $ response , array $ args = []): Response {
87
- echo $ this ->ifutils ->getDeploymentsJson ($ args ['deploy ' ] ?? false );
88
- return $ response ->withHeader ('Content-Type ' , 'application/json ' );
85
+ public function getDeployments (Request $ request , Response $ response , array $ args = []): Response
86
+ {
87
+ $ db = new \Glued \Lib \Sql ($ this ->pg , 'if__deployments ' );
88
+ $ db ->selectModifier = "jsonb_build_object('uri', concat(' {$ this ->settings ['glued ' ]['baseuri ' ]}/ {$ this ->settings ['routes ' ]['be_if_svc_s4s ' ]['pattern ' ]}v1/', doc->>'uuid'), 'nonce', nonce, 'created_at', created_at, 'updated_at', updated_at) || " ;
89
+ $ data = $ db ->getAll ();
90
+ //$db->stmt->debugDumpParams();
91
+ return $ response ->withJson ($ data );
89
92
}
90
93
91
94
}
@@ -136,28 +139,6 @@ public function services_r1(Request $request, Response $response, array $args =
136
139
return $response->withJson($payload);
137
140
}
138
141
139
- public function deployments_c1(Request $request, Response $response, array $args = []): Response
140
- {
141
- $params = $request->getQueryParams();
142
- $contentTypeHeader = $request->getHeaderLine('Content-Type') ?? '';
143
- if ($contentTypeHeader !== 'application/json') { throw new \Exception('Invalid Content-Type. Please set `Content-Type: application/json', 400); }
144
- $payload = $request->getParsedBody();
145
- foreach ($payload as $item) {
146
- $svc_uuid = \Ramsey\Uuid\Uuid::uuid4()->toString();
147
- $svc_data = json_encode($item['deployment']);
148
- $res = $this->mysqli->execute_query('SELECT bin_to_uuid(`c_uuid`,true) as svc_uuid FROM `t_if__deployments` WHERE JSON_CONTAINS(c_data, ?, "$")', [$svc_data]);
149
- foreach ($res as $r) { $svc_uuid = $r['svc_uuid']; break; }
150
- $this->mysqli->execute_query("INSERT INTO `t_if__deployments` ( `c_uuid`, `c_data` ) VALUES ( UUID_TO_BIN(?, true), ? ) ON DUPLICATE KEY UPDATE `c_data` = values(`c_data`)", [$svc_uuid, $svc_data]);
151
-
152
- foreach ($item['actions'] as $a) {
153
- $act_uuid = \Ramsey\Uuid\Uuid::uuid4()->toString();
154
- $data = ['c_deployment_uuid' => $svc_uuid, 'c_uuid' => $act_uuid, 'c_data' => json_encode($a)];
155
- $this->db->rawQuery('INSERT INTO `t_if__actions` ( `c_deployment_uuid`, `c_uuid`, `c_data` ) VALUES ( UUID_TO_BIN(?, true), UUID_TO_BIN(?, true), ? ) ON DUPLICATE KEY UPDATE `c_data` = VALUES(`c_data`)', $data);
156
- }
157
- }
158
- return $response->withJson($payload);
159
- }
160
-
161
142
162
143
public function queue_r1(Request $request, Response $response, array $args = []): Response
163
144
{
0 commit comments