File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,19 @@ DRepData AS (
266266 off_chain_vote_drep_data .image_url ,
267267 off_chain_vote_drep_data .image_hash ,
268268 (
269- SELECT jsonb_agg(ref)
269+ SELECT jsonb_agg(
270+ jsonb_build_object(
271+ ' uri' , COALESCE(
272+ CASE WHEN jsonb_typeof(ref- > ' uri' ) = ' string' THEN ref- >> ' uri' END,
273+ ref- > ' uri' - >> ' @value'
274+ ),
275+ ' @type' , ref- >> ' @type' ,
276+ ' label' , COALESCE(
277+ CASE WHEN jsonb_typeof(ref- > ' label' ) = ' string' THEN ref- >> ' label' END,
278+ ref- > ' label' - >> ' @value'
279+ )
280+ )
281+ )
270282 FROM jsonb_array_elements(
271283 CASE
272284 WHEN (ocvd .json ::jsonb)- > ' body' - > ' references' IS NOT NULL
@@ -277,7 +289,19 @@ DRepData AS (
277289 WHERE ref- >> ' @type' = ' Identity'
278290 ),
279291 (
280- SELECT jsonb_agg(ref)
292+ SELECT jsonb_agg(
293+ jsonb_build_object(
294+ ' uri' , COALESCE(
295+ CASE WHEN jsonb_typeof(ref- > ' uri' ) = ' string' THEN ref- >> ' uri' END,
296+ ref- > ' uri' - >> ' @value'
297+ ),
298+ ' @type' , ref- >> ' @type' ,
299+ ' label' , COALESCE(
300+ CASE WHEN jsonb_typeof(ref- > ' label' ) = ' string' THEN ref- >> ' label' END,
301+ ref- > ' label' - >> ' @value'
302+ )
303+ )
304+ )
281305 FROM jsonb_array_elements(
282306 CASE
283307 WHEN (ocvd .json ::jsonb)- > ' body' - > ' references' IS NOT NULL
You can’t perform that action at this time.
0 commit comments