Skip to content

Commit

Permalink
rewrite it like mr. propper
Browse files Browse the repository at this point in the history
  • Loading branch information
killua-eu committed Oct 9, 2023
1 parent 36d382e commit 50ff575
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 50 deletions.
49 changes: 0 additions & 49 deletions glued/Config/Migrations/20230625214406_init.sql

This file was deleted.

18 changes: 18 additions & 0 deletions glued/Config/Migrations/20231009002534_actions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- migrate:up

CREATE TABLE `t_if__actions` (
`c_svc_uuid` binary(16) NOT NULL COMMENT 'IF instance uuid (v4), autogenerated on SQL insert if not provided. NOTE to always insert with UUID_TO_BIN(UUID(), true)',
`c_uuid` binary(16) NOT NULL DEFAULT (uuid_to_bin(uuid(),true)) COMMENT 'IF action uuid (v4), autogenerated on SQL insert if not provided. NOTE to always insert with UUID_TO_BIN(UUID(), true)',
`c_data` json NOT NULL COMMENT 'JSON data',
`c_type` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.type'))) STORED COMMENT '[STORED] Interface Framework action type',
`c_note` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.note'))) STORED COMMENT '[STORED] Interface Framework action note',
`c_freq` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.freq'))) STORED COMMENT '[STORED] Interface Framework action frequency',
PRIMARY KEY (`c_uuid`),
UNIQUE KEY `uniq_svc_uuid_type` (`c_svc_uuid`,`c_type`),
KEY `idx_svc_uuid` (`c_svc_uuid`),
KEY `idx_type` (`c_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='Integration framework service instance actions.';

-- migrate:down

DROP TABLE IF EXISTS `t_if__actions`;
19 changes: 19 additions & 0 deletions glued/Config/Migrations/20231009002540_logs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- migrate:up

CREATE TABLE `t_if__logs` (
`c_act_uuid` binary(16) NOT NULL COMMENT 'IF instance uuid (v4), autogenerated on SQL insert if not provided. NOTE to always insert with UUID_TO_BIN(UUID(), true)',
`c_uuid` binary(16) NOT NULL DEFAULT (uuid_to_bin(uuid(),true)) COMMENT 'IF instance logline uuid (v4), autogenerated on SQL insert if not provided. NOTE to always insert with UUID_TO_BIN(UUID(), true)',
`c_data` json NOT NULL COMMENT 'JSON response body (files will be attached to stor by c_svc_uuid/c_uuid',
`c_ts_requested` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp: requested',
`c_ts_responded` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp: responded',
`c_ok` tinyint(1) DEFAULT NULL COMMENT 'Integration run success/fail',
`c_response_hash` varchar(255) DEFAULT NULL COMMENT 'Response data hash',
`c_response_fid` varchar(255) DEFAULT NULL COMMENT 'Response foreign identifier',
PRIMARY KEY (`c_uuid`),
KEY `idx_act_uuid` (`c_act_uuid`),
KEY `idx_response_hash` (`c_response_hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='Integration framework service logs.';

-- migrate:down

DROP TABLE IF EXISTS `t_if__logs`;
18 changes: 18 additions & 0 deletions glued/Config/Migrations/20231009002603_services.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- migrate:up

DROP TABLE IF EXISTS `t_if__services`;

-- migrate:down

CREATE TABLE `t_if__services` (
`c_uuid` binary(16) NOT NULL DEFAULT (uuid_to_bin(uuid(),true)) COMMENT 'IF service instance uuid (v4), autogenerated on SQL insert if not provided. NOTE to always insert with UUID_TO_BIN(UUID(), true)',
`c_data` json NOT NULL COMMENT 'JSON data',
`c_hash` varchar(32) GENERATED ALWAYS AS (md5(`c_data`)) STORED COMMENT '[STORED] MD5 Hash of the data json (acting as a unique index)',
`c_type` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.type'))) STORED COMMENT '[STORED] Interface Framework service type',
`c_name` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.name'))) STORED COMMENT '[STORED] Interface Framework service deployment name',
`c_host` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.host'))) STORED COMMENT '[STORED] Interface Framework remote host',
`c_note` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`c_data`,_utf8mb4'$.note'))) STORED COMMENT '[STORED] Interface Framework remote note',
PRIMARY KEY (`c_uuid`),
UNIQUE KEY `c_hash` (`c_hash`),
KEY `idx_type` (`c_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='Integration framework service instances (service / remote host / authentication).';
2 changes: 1 addition & 1 deletion glued/Config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ routes:
be_if_logs_v1:
pattern: ${routes.be_if.path}/logs/v1
path: ${routes.be_if.path}/logs/v1
label: IF Statistics
label: IF Logs
dscr: Interface logs
service: if
methods:
Expand Down
7 changes: 7 additions & 0 deletions glued/Controllers/IfController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ public function reg_r1(Request $request, Response $response, array $args = []):
return $response->withJson($res);
}

public function stats_r1(Request $request, Response $response, array $args = []): Response
{
$res = ['status' => 'ok', 'message' => 'This endpoint is under development.'];
return $response->withJson($res);
}


}


Expand Down

0 comments on commit 50ff575

Please sign in to comment.