brian-terranfcommunity.near Post Reply Counts
    Updated 2023-09-07
    -- forked from nfcommunity.near Posts/Replies/Likes in Order @ https://flipsidecrypto.xyz/edit/queries/bfd39342-68b6-488d-aa1c-438677a6ca11

    WITH main_posts as (

    select block_timestamp,
    tx_hash,
    block_id as og_post_id,
    block_id as current_post_id,
    signer_id,
    post_text
    from near.social.fact_posts
    where signer_id = 'nfcommunity.near'
    )
    ,
    reply_posts as (

    select block_timestamp,
    tx_hash,
    try_parse_json(try_parse_json(try_parse_json(node_data):"comment"):"item"):"blockHeight" as og_post_id,
    block_id as current_post_id,
    signer_id,
    try_parse_json(try_parse_json(node_data):"comment"):"text" as post_text
    from near.social.fact_decoded_actions
    where (node_data::string LIKE '%nfcommunity.near%'
    or signer_id = 'nfcommunity.near')
    and node = 'post'
    and og_post_id is not null

    ),
    all_posts as (
    select * from main_posts
    UNION ALL
    select * from reply_posts
    ),
    likes as (
    select *,
    Run a query to Download Data