Skip to content
Snippets Groups Projects
Commit e79042b6 authored by Michal Zander's avatar Michal Zander
Browse files

Add default for get_balance_delegations

parent 96d3fd50
No related branches found
No related tags found
2 merge requests!168Update return types: VEST balances should be returned as strings to address JSON limitations,!160Add daily and monthly aggregations for balances
......@@ -48,10 +48,9 @@ $$
DECLARE
_account_id INT = (SELECT av.id FROM hive.accounts_view av WHERE av.name = "account-name");
BEGIN
RETURN (
SELECT json_build_object(
'outgoing_delegations', (
'outgoing_delegations', COALESCE((
SELECT to_json(array_agg(row)) FROM (
SELECT
(SELECT av.name FROM hive.accounts_view av WHERE av.id = d.delegatee) AS delegatee,
......@@ -61,8 +60,8 @@ BEGIN
FROM current_accounts_delegations d
WHERE delegator = _account_id
) row
),
'incoming_delegations', (
), '[]'::JSON),
'incoming_delegations', COALESCE((
SELECT to_json(array_agg(row)) FROM (
SELECT
(SELECT av.name FROM hive.accounts_view av WHERE av.id = d.delegator) AS delegator,
......@@ -72,7 +71,7 @@ BEGIN
FROM current_accounts_delegations d
WHERE delegatee = _account_id
) row
)
), '[]'::JSON)
)
);
END
......
......@@ -94,6 +94,7 @@ psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_S
psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_SCHEMA};" -f "$SCRIPTPATH/../endpoints/account-balances/get_balance_history.sql"
psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_SCHEMA};" -f "$SCRIPTPATH/../endpoints/account-balances/get_account_balances.sql"
psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_SCHEMA};" -f "$SCRIPTPATH/../endpoints/account-balances/get_history_aggregation.sql"
psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_SCHEMA};" -f "$SCRIPTPATH/../endpoints/account-balances/get_account_delegations.sql"
psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_SCHEMA};" -f "$SCRIPTPATH/../dump_accounts/account_dump_schema.sql"
psql "$POSTGRES_ACCESS" -v ON_ERROR_STOP=on -c "SET SEARCH_PATH TO ${BTRACKER_SCHEMA};" -f "$SCRIPTPATH/../dump_accounts/account_stats_btracker.sql"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment