More work on hooks

This commit is contained in:
Magnus Åhall 2025-08-07 15:51:15 +02:00
parent 392aa0d11f
commit 2a04cba42a
5 changed files with 164 additions and 4 deletions

19
node.go
View file

@ -84,7 +84,24 @@ func GetNode(nodeID int) (node Node, err error) { // {{{
) AS res
)
, '[]'::jsonb
) AS ConnectedNodes
) AS ConnectedNodes,
COALESCE(
(
SELECT jsonb_agg(res)
FROM (
SELECT
h.id,
to_jsonb(s) AS script,
ssh
FROM hook h
INNER JOIN public.script s ON h.script_id = s.id
WHERE
h.node_id = n.id
) AS res
)
, '[]'::jsonb
) AS ScriptHooks
FROM public.node n
INNER JOIN public.type t ON n.type_id = t.id